03-29-2006 01:06 PM
OK,
I have already looked at that doc too long.
What would be more helpful would be a VI with more than one "update" as read from the serial port in hex mode.
I suggest you srart with
examples >>> Hardwae I/O >>> Serial >>> Basic serial write read
Set your baud and parity
disable the term character
specify an extremely large time out value
Change the "Bytes Read" control to a control (after disconnecting from the bytes at port node)
Set the number of bytes to read to something extremely large.
Run the VI and just to do the "Read" part.
Right click the "Read String" indicator and look at the data as hex.
If you can adjust the size of the string indicator so that you can "collumns" that match-up...
It is probably fixed length
The collumns that match-up will show the byte values used to frame the data.
If you save the string indicator with recieved data as its default, you can post it and we can probably decypher the format for you.
I will watch for you to post the VI because I am now curious.
Have fun,
Ben
03-29-2006 10:27 PM
03-30-2006 07:53 AM - edited 03-30-2006 07:53 AM
Hi Frank!
There is a phrase bieng used on LAVA alot these days that I'd like to paraphrase as "Talk is cheap, show me the [data]."
You data has no term character unless you want to call the "$" the term character.
The attached VI may help you get going. It Parse the data data stream into packets.
It first locates the first "#" then verifies the "@" and the "$" are in the right places relative to the "#". If all three can be found were they are supposed to be, it conciders it a valid mesage and pulls the message data out and puts it in an array.
I hope this helps,
Ben
Message Edited by Ben on 03-30-200607:54 AM
03-30-2006 05:29 PM
03-30-2006 05:56 PM - edited 03-30-2006 05:56 PM
Message Edited by Ben on 03-30-2006 05:58 PM
03-31-2006 09:41 AM
Frank,
Are you OK with your project?
Ben
04-01-2006 06:33 PM
Hi
The error correction of ben's vi could prevent some possible missing or corrupted data being plotted incorrectly by JLS vi. I think keeping the sensor transmit its data in binary form allows ben's vi to check whether it is a valid piece of data. But how do I convert the parsed HEX data back into numeric values (x, y and z axis numbers) which can be plotted in JLS vi.
Any suggestions. Thanks for the continued interest in this project.
Frank.
04-02-2006 11:11 AM - edited 04-02-2006 11:11 AM
Hi Frank,
Try this code for example.
Its a mod of what I posted earlier. I corrected my byte offsets (that were wrong! I was missing half the messages) and added logic to track message fragments from call to call.
I also convert the strngs to numbers for you to plot.
Operation:
On the first call to this VI the "left over" shift register is cleared. There after, the bytes left over after parsing a string are saved and then prepended to the incoming data stream.
The data is then framed and the data packets extracted from the data stream and accumulated in an array of strings.
The strings are then type cast as an array of U16. The is one collumn for each value and one row for each update.
Try to adapt a version of hist in your application and post the complete app if you need to ask follow-up Q's.
Trying to help,
Ben
Message Edited by Ben on 04-02-2006 11:12 AM
04-03-2006 11:02 AM
04-05-2006 10:00 PM
Hi
Sorry JLS for the confusion from a newbie. The sensot has three ouput
ascii number of x y and z axis data
x= 1 y=0.4 z=0.32
Raw data format
X=0x01A2 Y=0x0255 Z=0x0340
and finally binary format
Byte Description
0 Start Char- #
1 Data output designator- @
2 Sample No High Byte
3 Sample No Low Byte
4 X Hi Byte
5 X Lo Byte
6 Y Hi byte
7 Y Lo byte
8 Z Hi byte
9 Z Lo byte
10 End Char- $
The manual suggested that this format might be more suitable for pc processing. At the moment I trying to figure out how to wire in bens vi which check the data, converts it to numbers and then plot it.
The first set of no.s is the sample no.=0-65000 and then rolls back to zero. The other three no.s are x y and z axis data. I just need the x, y and z in the graphing format you previously recommended. I will continue to look at before i come asking for more help! Thank god I think we are nearly there 🙂 thanks to jls and ben
Frank