Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

tnt 5002 interface

Ok,

Thanks Mr Collin

0 Kudos
Message 71 of 151
(1,888 Views)

 

Mr Collin,

hast you found some thing??

0 Kudos
Message 72 of 151
(1,869 Views)

Mr Collin,

hast you found some thing?

Thanks,

0 Kudos
Message 73 of 151
(1,863 Views)
I haven't been able to find the GPIB card you are using to try to duplicate the experiment. Is it possible for you to get a National Instruments PCI-GPIB?
0 Kudos
Message 74 of 151
(1,855 Views)
Mr Collin
I have found the error, it whas the connector  somme pin where not connect correctly...
also the PCI_gpib after the initialize sequens reconise the tnt5002.... 
now i am trying to get the communication between the tnt and the .
Thanks for all the support....
0 Kudos
Message 75 of 151
(1,825 Views)
Well, I'm glad that is over with. When you say some pins were not connected correctly do you mean they weren't soldered correctly or was the connector broken somehow?
0 Kudos
Message 76 of 151
(1,815 Views)
The Connector weren't soldered correctly ,
 
Now i have a small software probleme  I whanted the tnt 5002 to response to this question id?(also a communication between the host and the tnt 5002), I write two routine Gpib_receive and Gpib_send

                Update_5002_Interface_Status();        // Check Status                        
                if(INTERFACE_STATUS == 0x4A) // Read the ADSR register and check the adress status
                        Gpib_Send();    
                else
                        if(INTERFACE_STATUS == 0x44)
                            Gpib_Receive();
.--
----
here are the code
 
1) Gpib_Send()
char gpib_Snr[] = {'t','n','t',5,0,0,2};
Write(RstFifo, CMDR)// reset fifo
Write(E_TLCHLTE|E_IN|(E_168 & 0x00))// set the tlchlte bit, data in bit, and enable the tnt to use fifo
Write(E_ERR|E_END, IMR1)// enable the error and the end receive interrupt
Write((E_DMAO & 0x00)  |  (E_DMAI & 0x00)  |  E_ADSC,  IMR2); // no dma use and enable adress change bit
 Write(E_TLCINT | E_DONE| E_NFF, IMR3);// enable the no fifo full bit

for(int i=0; i<6;i++)
{   
   Write(gpib_Snr[i] , FIFOA);// Load a string in to the fifo and send it to the bus..
   
}
   WriteGpib(GO, CMDR); 
        // Conducting the transfert
 
 
 
2) Gpib_Receive(char buff)
 
char buff[3];
 
Write(RstFifo, CMDR)// reset fifo
 
Write((E_TLCHLTE | (E_IN&0x00) | (E_168N & 0x00)), CFG);   //set the tlchlte bit, data out bit, and enable the tnt to use fifo
 
Write(E_ERR,  IMR1)// enable the error
 
(((E_DMAO & 0x00) | (E_DMAI & 0x00) | E_ADSC), IMR2);         // no dma use and enable adress change bit
 
WriteGpib((E_TLCINT | E_DONE| E_NEF),  IMR3);                       //enable the no fifo full bit
 
Write(GO, CMDR)                     //start the transfert
for(int i=0; i<3;i++)
{    Buff[i]= Reag(FIFOA);                                                            // Load the string from the fifo in to Buff[]
   
}
 
3) the tnt5002 is able to write to the bus when he receive its talker address also 0x4A
and he  is not able to receive data when he receive  its listeber adress  0x44 ??
0 Kudos
Message 77 of 151
(1,801 Views)
 
Mr Collin,
 
Is my send and receive routine correct?
 
1) Gpib_Send()
char gpib_Snr[] = {'t','n','t',5,0,0,2};
Write(RstFifo, CMDR)// reset fifo
Write(E_TLCHLTE | E_IN | (E_168 & 0x00),  CFG)                           // set the tlchlte bit, data in bit, and enable the tnt to use fifo
Write(E_ERR|E_END, IMR1) ;                                                           // enable the error and the end receive interrupt
Write((E_DMAO & 0x00)  |  (E_DMAI & 0x00)  |  E_ADSC,  IMR2);   // no dma use and enable adress change bit
 Write(E_TLCINT  |  E_DONE |  E_NFF,   IMR3);                                 // enable the no fifo full bit

for(int i=0; i<6;i++)
{   
   Write(gpib_Snr[i] , FIFOA);// Load a string in to the fifo and send it to the bus..
   
}
   WriteGpib(GO, CMDR); 
        // Conducting the transfert
 
 
 
2) Gpib_Receive(char buff)
 
char buff[3];
 
Write(RstFifo, CMDR)// reset fifo
 
Write((E_TLCHLTE | (E_IN&0x00) | (E_168N & 0x00)), CFG);   //set the tlchlte bit, data out bit, and enable the tnt to use fifo
 
Write(E_ERR,  IMR1)// enable the error
 
(((E_DMAO & 0x00) | (E_DMAI & 0x00) | E_ADSC), IMR2);         // no dma use and enable adress change bit
 
WriteGpib((E_TLCINT | E_DONE| E_NEF),  IMR3);                       //enable the no fifo full bit
 
Write(GO, CMDR)                     //start the transfert
for(int i=0; i<3;i++)
{    Buff[i]= Reag(FIFOA);                                                            // Load the string from the fifo in to Buff[]
   
}
 
0 Kudos
Message 78 of 151
(1,791 Views)
First, can you clarify you are using the TNT5002 manual, not the TNT4882 manual?

In the TNT5002 manual there are specific instructions for implementing GPIB send and receive functions. Look at page 4-11, titled "GPIB Transfer Manager". This section gives exact register settings for implementing these functions.


See below for comments on your firmware. My comments will start with --

1) Gpib_Send()
char gpib_Snr[] = {'t','n','t',5,0,0,2};
--I think this should be {'t','n','t','5','0','0','2'}

Write(RstFifo, CMDR)// reset fifo
Write(E_TLCHLTE | E_IN | (E_168 & 0x00),  CFG)                           // set the tlchlte bit, data in bit, and enable the tnt to use fifo
--For a GPIB write operation, the IN bit should be clear. I think you are setting it here and that is incorrect. Can you verify that CFG[IN] is cleared? You should also set CCEN if you want to assert the GPIB EOI signal with the last byte.

Write(E_ERR|E_END, IMR1) ;                                                           // enable the error and the end receive interrupt
--Setting the END interrupt only makes sense when receiving data. This causes an interrupt when the END condition is received by the TNT5002.

Write((E_DMAO & 0x00)  |  (E_DMAI & 0x00)  |  E_ADSC,  IMR2);   // no dma use and enable adress change bit
--The bits E_DMAO and E_DMAI aren't used in the TNT5002, only the TNT4882. What manual are you using? You should be using the TNT5002 programming manual. I think you have the TNT4882 manual if you see information about DMAO and DMAI. Also, if you are executing code for a GPIB write then you probably don't need to check the ADSC bit as you should already know that you are a GPIB talker.

Write(E_TLCINT  |  E_DONE |  E_NFF,   IMR3);                                 // enable the no fifo full bit
--You usually interrupt on NFF when you write data to the FIFO in the interrupt service routine. This is fine but it looks like you write data to the FIFO in the next line of code here. I think this interrupt will assert immediately after writing GO to the CMDR.

for(int i=0; i<6;i++)
{   
   Write(gpib_Snr[i] , FIFOA);// Load a string in to the fifo and send it to the bus..
   
}
-- If you configure the FIFOs as 1-byte wide (by clearing CFG[16/8N] then only FIFOB should be used.

   WriteGpib(GO, CMDR); 
        // Conducting the transfert
-- You need to also write the byte count to the CNT registers. See the TNT5002 manual for more informations.



2) Gpib_Receive(char buff)
 
char buff[3];
 
Write(RstFifo, CMDR)// reset fifo
 
Write((E_TLCHLTE | (E_IN&0x00) | (E_168N & 0x00)), CFG);   //set the tlchlte bit, data out bit, and enable the tnt to use fifo
--The IN bit should be set when the TNT5002 is receiving data.

 
Write(E_ERR,  IMR1)// enable the error
--You don't need to detect the ERR condition as a GPIB receiver.

 
(((E_DMAO & 0x00) | (E_DMAI & 0x00) | E_ADSC), IMR2);         // no dma use and enable adress change bit
-- see previous comments about DMAO/DMAI.

WriteGpib((E_TLCINT | E_DONE| E_NEF),  IMR3);                       //enable the no fifo full bit
 
Write(GO, CMDR)                     //start the transfert
for(int i=0; i<3;i++)
{    Buff[i]= Reag(FIFOA);                                                            // Load the string from the fifo in to Buff[]
   
}
--see previous comment about using FIFOB.

-- You need to also write the byte count to the CNT registers. See the TNT5002 manual for more informations. 



0 Kudos
Message 79 of 151
(1,782 Views)

I am using the two maual.

i have changed my code , and he still not work correctly here are the code

 

1) Gpib_send(char *S, int cnt) // Send data to the bus when address als talk

{


   WriteGpib(0x09, CFG);// Configure Chip for sending data

   WriteGpib((char)(cnt), CNT0);// Number of byte to be send
    WriteGpib(0x00, CNT1);
    WriteGpib(0x00, CNT2);
    WriteGpib(0x00, CNT3);


  WriteGpib(RstFIFO,CMDR);// Reset the fifo 
    // Interrupt
   WriteGpib(E_ERR, IMR1); // detect error condition  

for(i=0; i<7;i++)
{   
   WriteGpib(S[i], FIFOA); // write data to the bus
   WriteGpib(GO, CMDR);    // commando Go to start the trandfert   
}

WriteGpib(STOP, CMDR);// stop the transfert

WriteGpib(CLrADSC, AUXMR);// clear adress statut

}

 

2)char Gpib_Receive1(int cnt)// receive data from the bus

{
    int i;
    int a;   
    char Gpib_buffer1[16];
    a = 0;

     i=0;

// Init Data Transfert
   WriteGpib(RstFIFO,CMDR);
   WriteGpib(0x21, CFG);// Configure the chip for gpib Data transfert
    // Number of byte to be read
  WriteGpib((char)(cnt), CNT0);
  WriteGpib(0x00, CNT1);
  WriteGpib(0x00, CNT2);
  WriteGpib(0x00, CNT3);

// end os string chararacter
   WriteGpib(0x0D, EOSR);
   WriteGpib(0x16, AUXRA);


   WriteGpib(RHDF, AUXMR);
 
   WriteGpib(GO, CMDR);
for(i=0; i<16;i++)
{
   
  Gpib_buffer1[a] = ReadGpib(FIFOA);
   ++a;
             RSendChar(LF);             // GpibData2 Receive über Rs232
             RSendChar(ReadGpib(FIFOA));// read data that i get from the bus
             RSendChar(LF);
}


    // Interrupt
    (E_END, IMR1);
    (E_TO_IE|E_NLEN , IMR0);
    WriteGpib(E_TLCINT | E_DONE| E_NEF, IMR3);
  
    WriteGpib(STOP, CMDR);

 return  Gpib_buffer1;                 

}

 

3) i have some probleme

- My litener address geve me 0x44 it is okay? // when  i make a ibwrt to the device i read ADSR=0x44

-My Talk address give me 0x4A it is okay?

- when i make a ibrd or ibwrt i alwas get ISR2=0x10,  although i have set the more bit in IMR2 register by the initialize// WriteGpib(E_ADSC, IMR2); 

-when i make a ibrd or ibwrt some time  he work and somme time i get a error

-how can i read data from the fifo, i write this sequenz to read data form the fifo and i always  read 0x00

for(i=0; i<16;i++)
{
   
  Gpib_buffer1[a] = ReadGpib(FIFOA);
   ++a;
             RSendChar(LF);             // GpibData2 Receive über Rs232
             RSendChar(ReadGpib(FIFOA));
             RSendChar(LF);
}
   

Thanks...

although
0 Kudos
Message 80 of 151
(1,767 Views)