When the LAM is set and I read the module, it doesn't have any data. Why?

If enabled, the LAM is set whenever the first bit in the Hit Register is set.

It takes 7.2us to multiplex all 16 channels through the ADC.  Each channel is compared to it's threshold levels and as soon as the first channel with valid data sets it's bit in the Hit Register, a LAM is generated. This will occur before the module has finished converting all 16 channels.  If you attempt a read during the 7.2us conversion time, you will not get the proper data. Usually you will read "0" because you should not be able to access the module during the conversion cycle.
Example:  With the LAM enabled and  the thresholds not enabled, all channels will have valid data (even if it's 0 or full scale).  The first channel converted will set it's bit in the hit register.  This sets the LAM.  There is still over 6us of conversion time required to convert the next 15 channels.  If your Controller Software uses this indication to start reading the module, you will probably be reading it to soon.  A delay of at least 7.2us from the beginning of the conversion is required before reading the module.

Sample Procedure
Clear Module
Enables LAM
External Gated Event
External Test Event
   Delay  (or)
* F(8) Loop
Wait 7.2us minimum for conversion of all 16 channels (or)
Test LAM looking for Q=1
F(0) A(0)
Read channel 1
F(0) A(1) thru F(0) A(15)
Read Channels 2 thru 16
F(11) A(3) Clears the Hit Register, Data Memory and Resets the LAM so you can accept another external event.
 Go to 3rd step  (External Gated Event) and repeat the procedure.

* An F(8) Loop can be used instead of the 7.2 us delay
. You can use a "Test LAM" loop by continuously polling the module with an F(8) looking for Q=1.  The module will not accept this command until the conversion cycle has completed. therefore the Q should = 0 until the module is ready to be read.

Back to Technical Questions