Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

i have made a gpib controller with p89v51rd2bn. I need a c code to configure tnt4882 as a listener and a seprate c code as a talker and please explain functions used in that.

computer is reading my device but it is showing that it doesnot respond to idn query
0 Kudos
Message 2 of 7
(4,398 Views)

Hello,

 

There is a source code package that can be used to get the TNT4882 to respond to queries such as *IDN?.  There are two versions, one that uses interrupts and one that does not.  If you trace the function calls down to the lowest levels, you will see that the TNT4882 registers are being accessed by Memory IO functions.

 

I would recommend spending some time going over the code and correslating the function names with the register accesses made (using the TNT4882 manual).

http://joule.ni.com/nidu/cds/view/p/id/223/lang/en

 

I hope this helps,

Steven T.

0 Kudos
Message 3 of 7
(4,392 Views)

My microcontroller is communicating with 4882. we want to use labview to communicate with the tnt4882 from pc end. is there any application code available also primary address of the device is being identified but is not responding to *idn query

0 Kudos
Message 4 of 7
(4,377 Views)
Your questions are confusing. First you ask for some c code and now you ask for some LabVIEW code. There palettes for GPIB and VISA but typically all you would need is a VISA Write or VISA Read. Of course, no LabVIEW code is going to help you with the no response to an *IDN? query. You would have to code that into the microcontroller. If you don't support the *IDN? query, your instrument is not compliant with IEEE-488.2.
0 Kudos
Message 5 of 7
(4,373 Views)

Hey Dennis,

I understand what you are trying to say. It would be helpful if you pointed me to the documents that would tell me what configuration the TNT4882  should be put to inorder to have it communicate with VISA.

This is what I have done...

 


void TNT_config(void){
 XBYTE[CMDR] = 0x22;  //soft reset command to command register
 
 XBYTE[SPMR] = 0x80;  //following steps configure the TNT into turbo+7210 mode
 XBYTE[AUXMR]= 0x80;  // do
 XBYTE[SPMR]= 0x99;  // do
 XBYTE[AUXMR]= 0x99;  // do

 XBYTE[HSSEL]  = 0x01;  //Configure TNT to one chip mode
 
 XBYTE[AUXMR]= 0x02;  //To make sure that the local PON message is asserted.
 // to logically disconnect the GPIB and GPIB interface
 //Configure the TNT for GPIB operation
 XBYTE[ADMR]= 0x31;  //To set the TNT in dual primary addressing mode.
 XBYTE[ADR]= 0x0A;  //The primary address of the built GPIB card as seen by the MAX
 XBYTE[ADR]= 0xE0;  //TNT has no secondary address
 XBYTE[AUXMR] = 0x51;  //hold off handshake immediately

 XBYTE[SPMR]= 0x01;  //Initial serial poll response byte

 //Enable interrupts
 XBYTE[IMR0] =  0xAD;
 XBYTE[IMR1] =  0x00;
 XBYTE[IMR2] =  0x00;
 XBYTE[IMR3] =  0x08;

 XBYTE[HIER] =  0xC0; //To select deglitching circuit on the TNT

 XBYTE[AUXMR]=  0x00; //To clear the local PON message
 return;
}

 

Max is reading the address as 10. we want to confiqure tnt as  a listener.so do we have to write the address as 2A instead of 0A in ADR  register?

0 Kudos
Message 6 of 7
(4,368 Views)

Devika,

 

I don't think that you understand how invovled your question is.  Getting your instrument to respond to the *IDN? query is quite complicated.  However, we know that your TNT4882 is initialized correctly because it is showing up in MAX when you scan for instruments.  This means that you have successfully followed the directions in Chapter 4 of the TNT4882 Programmer Reference Manual.

 

Here are the additional steps necessary for communication (both sending and receiving data):

  1. Initialize the transfer
    1. Wait for the GPIB Controller to complete the necessary addressing (the TNT4882 must be addressed as talker to send data and listener to receive data)
    2. Reset the FIFO
    3. See the remaining steps on page 4-8 in the manual
  2. Conduct the transfer
    1. This is a fairly complicated state machine See page 4-9 in the manual.
  3. Post Transfer Termination (after the transfer is complete)
    1. Send the stop command
    2. Read the Counts to determine the number of bytes transferred
    3. See the remaining steps on page 4-12 in the manual.

Depending on how you are using the chip, there are numerous ways to implement these steps.  With a DMA transfer (over an ISA bus), with interrupts, or even using a timer for timeout detection.  Once you decide which features of the TNT4882 you want to use, you can see the manual for tips on implementation or you can see the source code package that I directed you to.  It is an actual implementation of an instrument responding to a *IDN? query.

 

The code that you posted will only get the instrument to respond to addressing by the controller.  It will not allow it to actually communicate.

 

I hope this helps,

Steven T.

0 Kudos
Message 7 of 7
(4,344 Views)