10-11-2005 07:10 AM
10-11-2005 07:43 AM
06-09-2010 09:41 AM
Hello all.
I have the same trouble with the FINDLSTN protocol. I tried to realize the talker/listener functions by AVR Atmega Controller + SN7516x Driver Chips. Everythings works fine, i can communicate with my Atmega but FINDLSTN finds a device on each address and only the right address is able to response to the "*IDN?" read.
here is my piece of code:
unsigned char
ieee488_check_addressed_state (void) {
unsigned char byte_in;
while (!(GPIB_Ctrl_Read & (1 << ATN))) {
// negate not ready for data
NRFD_NEGATE;
// while data is not valid
while (GPIB_Ctrl_Read & (1 << DAV));
// read data byte
byte_in = ~GPIB_Data_Read;
// accept byte
NDAC_NEGATE;
// while data valid is asserted
while (!GPIB_Ctrl_Read & (1 << DAV));
if (byte_in == (0x20 | GPIB_Address)) {
gpib.addressed = 1;
gpib.listen = 1;
ieee488_listener_init ();
return 1;
}
else
if (byte_in == (0x40 | GPIB_Address)) {
gpib.addressed = 1;
gpib.talk = 1;
ieee488_talker_init ();
return 1;
}
// clear data accepted state
NDAC_ASSERT;
}
return 0;
}
Now i found this forum post but the presented solution causes that no devices can be found on the bus.
unsigned char ieee488_check_addressed_state (void) { unsigned char byte_in; while (!(GPIB_Ctrl_Read & (1 << ATN))) { // negate not ready for data NRFD_NEGATE; // while data is not valid while (GPIB_Ctrl_Read & (1 << DAV)); // read data byte byte_in = ~GPIB_Data_Read; //printf("\r\n Byte: %c, %#X ", byte_in, byte_in); // accept byte //NDAC_NEGATE; if (byte_in == (0x20 | GPIB_Address)) { gpib.addressed = 1; gpib.listen = 1; // wait for ATN FALSE while ((GPIB_Ctrl_Read & (1 << ATN))); // accept byte NDAC_NEGATE; ieee488_listener_init (); return 1; } else if (byte_in == (0x40 | GPIB_Address)) { gpib.addressed = 1; gpib.talk = 1; // accept byte NDAC_NEGATE; ieee488_talker_init (); return 1; } else if (byte_in == 0x3F || byte_in == 0x5F) { gpib.addressed = 0; gpib.listen = 0; gpib.talk = 0; // accept byte NDAC_NEGATE; ieee488_listener_init (); return 1; } // assert NDAC NDAC_ASSERT; // assert NRFD NRFD_ASSERT; } return 0; }
Anyideas?