Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Capture data from comm port
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00054341
Message ID:
00054410
Views:
30
>I am trying to capture incommimg data from a bar code reader plugged
>into a serial port. I need to save it into some kind of a file which I can
>then make into a DBF. I don't know how to begin and haven't seen any
>examples. Any ideas?
>
>-Ray
>mlynczak@libertynet.org

Ray, as Craig has said, use MSCOMM32.OCX. It stores all of the incoming data in a buffer which you can then transfer to a form property or other storage.

Set your barcode reader to finish with a chr(13) (this is progammable on al the Barcode readers I've worked with). Parse the incoming data by searching the string for the Chr(13), and put the data into your table. Parse again....

** Pseudo code to follow
InputString = Myform.CommOCX.Input
Myform.Buffer = Myform.buffer + InputString

nPos = at(chr(13), Myform.buffer

cBarCode = substr(myform.buffer,1,nPOs-1) && Skip the chr(13)
**
** Store the barcode information here
**
if len(myform.buffer) > nPos
Myform.buffer = substr(myform.buffer, nPos+1) && get the rest of the string
endif

** And start at the top again.
<\pre>

This is NOT meant to be 'real' code - just to show you how to get started. I use this for a system that has up to 16 radio-scanners sending information in at once. The buffer holds the data and parses it out in chunks using the Chr(13). It even sends data BACK to the scanners.

If you get stuck, let me know and I'll send you some of my code.

HTH
Barbara
Barbara Paltiel, Paltiel Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform