Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sun Nov 19, 2017 8:51 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Mar 05, 2009 12:04 pm 
Offline

Joined: Tue Mar 03, 2009 8:00 am
Posts: 5
I am using the Q58B terminal with a barcodewand to record the lengths of fish. There is other information that I will be inputing with the barcode wand Spiecies,Sex of Fish.

I have the following questions.

1. What is better to use the DataGrid or DataLogger ? I have already created a Datagrid with Colums and Rows it looked like the simplest to create. But the DataLogger looked very usable also for this task.

2. How do I get my data coming in from the Basic Serial (BarcodeWand) to post into the Datagrid in the correct cell ?

Thanks for the help
gmac


Top
 Profile  
 
PostPosted: Thu Mar 05, 2009 2:08 pm 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
Quote:
1. What is better to use the DataGrid or DataLogger ? I have already created a Datagrid with Colums and Rows it looked like the simplest to create. But the DataLogger looked very usable also for this task.


These objects have a different purpose. You could use the DataLogger to save data on the flash, and the DataGrid can be used to display data, but its data is not saved over a power cycle.

Quote:
2. How do I get my data coming in from the Basic Serial (BarcodeWand) to post into the Datagrid in the correct cell ?

First you'll need some parsing code in the BasicSerial object to separate the data into strings you'd like to display in the row. Once you have those strings, you can add them to a row. Here's an example where I want to parse an incoming serial stream which happens to be in the format of a comma seperated/semi-colon delimited list (example: 1,44,aa,55;), and then add the data as a new row in a datagrid.

Code:
'in Globals

func ParsePacket(pkt[] as reference to byte, sep as reference to string, dlm as reference to string)
    dim idx, end as integer
    dim items as string
    dim itemsI[] as integer

    idx := find(pkt, 0, -1, sep)
    while (idx >= 0) do
        _AppendString(mid(pkt, end, idx-end), items, itemsI)
        end := idx + len(sep)
        idx := find(pkt, end, -1, sep)
    loop

    idx := find(pkt, end, -1, dlm)
    if (end >= 0) then
        _AppendString(mid(pkt, end, idx-end), items, itemsI)
    endif

    DataGrid_1.InsertRows(DataGrid_1.numRows, 1)
    for idx = 0 to len(itemsI)-1
        DataGrid_1.SetCellText(DataGrid_1.numRows-1, idx, _GetString(idx, items, ItemsI))
        _Print(_GetString(idx, items, itemsI))
    next
endfunc

'in BasicSerial_1

func datareceived(data[] as byte)
    dim sep, dlm as string
    dim idx, end as integer
    dim pkt[] as byte
    dim items as string
    dim itemsI[] as integer

    sep := ","
    dlm := ";"

    buffer := buffer + data

    idx := find(buffer, idx, -1, dlm)
    while (idx >= 0) do
        idx := idx + len(dlm)
        pkt := mid(buffer, end, idx-end)
        ParsePacket(pkt, sep, dlm)
        end := idx
        idx := find(buffer, end, -1, dlm)
    loop
    buffer := mid(buffer, end, -1)
endfunc

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group