Loadstar Sensors LV-100 User Manual

Page 9

Advertising
background image

LoadVUE User Guide • 8

Writing Your Own Software to Communicate with iLoad Digital USB Sensors

Since the iLoad Digital USB Sensors present themselves to Windows as COM ports, it is very easy to write your own program
to read the sensor loads. Simply open the COM port from your application and send the string O0W1<CR>. Then read the
returned string back in millipounds. We recommend the following steps:

1. Open the port at 9600 (baud rate is not important), N, 8, 1.
2. Write a

<CR>

to the port.

3. Wait for a few milliseconds (say, 100 to 1000, this depends on your hardware, try a longer wait

first then shorten it to see what works. (An alternative is to wait until there is a required number
of characters in the input buffer, in this way the wait time is reduced to a minimum).

4. Read the input buffer and discard till there are no characters to read. (You can check if you get

an 'A' back)

5. Write

O0W1<CR>

to the port,

6. Wait again for a few milliseconds.
7. Read the input buffer and process. This will contain the weight.
8. Repeat Steps 5 to 7 as needed.
9. Discard any bytes left in the input buffer before you close the port.
10. Close the port.


If callbacks (or events) are available, it is preferable to use them instead of polling the sensor in step 7 above. This way
Windows will inform the application that there is data to be read.

Examples for Labview and Matlab are available on our support pages.

Loadstar Sensors, Inc. •

www.loadstarsensors.com

Advertising