Loadstar Sensors LoadVUE (LV-400,LV-1000,LV-4000,LV-7000) Load Cell User Manual

Page 20

Advertising
background image

LoadVUE User Guide • 18

Loadstar Sensors, Inc. •

www.loadstarsensors.com

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, N, 8, 1, No flow control. If you have a high speed version of the load cell
or interface open the port at 230400, N, 8, 1, No flow control.

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.

Advertising