02-04-2014 07:34 AM
@makewayforkhairil wrote:
And my checksum shows weirddd numbers, like AF, B0, 50, 6.
Those numbers aren't weird if you are thinking in hexadecimal. To convert to decimal, right-click the indicator on the FP and set Display Format to decimal. Otherwise, learn to think in hex (it really isn't that hard).
Cameron
02-07-2014 05:24 AM
Hes is some code to extract the data. You will need to set up the serial reads.
If it is just spewing serial data you could just do massive reads and use match pattern on the header, or you could read a byte at a time until you find the $, then do block reads from there.
deceased.
02-07-2014 08:51 AM - edited 02-07-2014 09:12 AM
This should do pretty much what you want.
The feedback nodes look a bit odd. But they would catch packets from strange data like $M$M>....etc
At the moment it only deals with cmd(104) ... if you need to implement others it should be easy enough.
The xor part will XOR all the data bytes, the cmd# and the checksum.
If the packet is good, the result will be the cmd#
You will need to set up the Baud rate etc.
Make sure the termination character is set OFF when configuring the port.
02-12-2014 09:32 PM
Hi deceased! Thank you so much for your help and effort. However, I'm having some problem. I am unable to run the VI due to an error.
"VISA: (Hex 0xBFFF006C) An overrun error occurred during transfer. A character was not read from the hardware before the next character arrived."
02-13-2014 02:56 AM
Hi makeway…,
that error occurs when you read the VISA buffer too slow. You need to read faster (using deceased's single byte approach) or more bytes at once!
I would read a fixed amount of bytes at once (let's say 16 bytes) and concatenate them in a string or byte array hold in a shift register…
02-14-2014 04:36 AM
What Baud rate have you set?
In the config.h file it says
/* This is the speed of the serial interface. 115200 kbit/s is the best option for a USB connection.*/
#define SERIAL_COM_SPEED 19200
Try setting it to 19200 in LabVIEW.
Picking bytes out of the buffer one at a time hasn't caused me issues before, but if it is problematic here you can resort to large serial reads, then parse out the string.
deceased