09-24-2008 10:08 AM
09-26-2008 07:33 AM
Any ideas?
Thanks.
09-26-2008 09:28 AM
Ahm,
Thank you for the well formatted code. From your routine, I see that you first check ADSC to see if your addressing has changed. This is where things go wrong. If the SISB bit in AUXRI is not clear, reading ISR2 will not clear ADSC. In the firmware of your instrument, read ISR2 again to verify that ADSC has cleared. If it has not, please use the clearADSC command to clear it after you read the ISR.
Write 5B to AUXMR.
Since your controller is not readdressing during your problem test, there should be no changes in ADSC, so it should be clear. That is why I suspect that you are not actually clearing that bit in your routine.
I hope this helps,
Steven T.
09-26-2008 10:50 AM
Steven,
thanks for your reply.
I just checked, that ADSC bit in ISR2 is cleared after reading ISR2.
This is what I expected since I don't use static interrupt bits (AUXRI is never written by my code, and should be zero after PON, shouldn't it?)
In my opinion, I should always get an ADSC interrupt, when I'm no longer Talker or Listener. Is this right?
If I send some messages to the TNT, this code works for 50...100 messages and then fails (which makes it hard to debug).
In case it fails, some characters at the beginning of the message are missing.
I think this is the result of resetting the FIFOs while TNT is already listening.
Maybe I'm thinking to complicated? Is there an example for a really *simple* listen/talk interrupt routine?
Thanks in advance!
09-29-2008 04:38 PM
Ahm,
This may not be the easiest source code, but it has a clearly defined Interrupt service routine and you can see how data is read.
http://joule.ni.com/nidu/cds/view/p/id/223/lang/en
This is the only real example that we have that shows how to communicate using the TNT4882. It was compiled using Microsoft C 2.0.
I hope this helps,
Steven T.
09-30-2008 09:28 AM
Hi Steven,
thanks for your answer.
I already knew the ESP-488 code, but for my controller this seems oversized.
For testing, I put my ISR in an empty project with an empty main loop, and it works much better.
So it seems, that there a race condition that fails, if the CPU cannot handle the interrupt fast enough.
So I will have to search further for this problem.
But once again the question, the principle interrupt handling in my ISR looks OK?
Thanks.
10-10-2008 04:12 AM
10-10-2008 03:00 PM
Hello,
I just finished testing the ESP code with all of the parameters that you explained and it performs correctly in all cases. I know that it seems a bit bulky, but it should be used as a starting point so you can start with something that works. The code can be compiled with Microsoft C 2.0. If you replace the OS specific portions of the code, it can be compiled with anything (but they are embedded throughout).
I hope this helps,
Steven T.