I2C Measurement Example - Ladybug LB5900 Series Interface Manual

Power sensor, spi & i2c interface
Hide thumbs Also See for LB5900 Series:
Table of Contents

Advertisement

I2C Measurement Example

●The following example details the use of the READ? query to make a measurement. Read is
often use programmatically because it establishes the beginning of the measurement when
issued. If continuous triggering is active, FETCh? can be used to collect a "trailing" measurement.
MEAS? may be inappropriate because the measurement time will vary due the use of automatic
averaging. Measurements made with no power applied can result in a 30 second return time if
using MEAS?
1. Test for ready see below
2. Write SYST:PRES DEF to the sensor using Header 06h, then wait 1ms
Clears any settings and sets the sensor to a known state
3. Test for ready see below
4. Write INIT:CONT 0 to the sensor using Header 06h, then wait 1ms
Turns off continuous initiation - sensor will then initiate after READ? is issued
5. Test for ready see below
6. Write AVER:COUN:AUTO 0 to the sensor using Header 06h, then wait 1ms
Turns off automatic averaging
7. Test for ready see below
8. Write FREQ 1000 MHZ (use your frequency) to sensor using Header 06h, then wait 1ms
Sets the measurement frequency
9. Test for ready see below
10. Write AVER:COUN 10 (use your # of averages) to sensor using Header 06h, then wait 1ms
Sets the number of averages
11. Test for ready see below
12. Write READ? to sensor using Header 06h
Initiates (Starts) the measurement
13. Wait the expected processing time (depends upon the number of averages)
14. Test for ready see below
15. Send Prepare Status & Length (no command) using Header 06h See Figure 13
16. Test for ready see below
17. Read 4 bytes from sensor - See Figure 14
18. Test the Status Byte if No data, wait at 50ms, or a time dependent upon the number of
averages, then return to #16
19. Using value returned in #17, write the number of bytes to the sensor that are to be read
back using Header 0Ch. See figure 15
20. Test for ready see below
21. Read back the measurement, specify the number of bytes as indicated by #17 – See also
Figure 16
22. Repeat 11-24 as required for the process (each time a measurement is required)
Test for Ready:
1. Write address only to the sensor See Figure 10
2. Test ACK/NACK if NACK, then wait 1ms and return to 1
DOC: SPII2CHDWBrief - V2.71 07/25/2017
PAGE 20

Advertisement

Table of Contents
loading

Table of Contents