07-10-2012 07:24 AM
It would be easiest to simply build an array of the length and data, do not include the header data. Calculate the checksum based on that array. Then do a final build array with the header data, previously build array (length and data), and the newly calculated checksum.
07-10-2012 10:19 AM
@crossrulz wrote:
It would be easiest to simply build an array of the length and data, do not include the header data. Calculate the checksum based on that array. Then do a final build array with the header data, previously build array (length and data), and the newly calculated checksum.
Here's the thing I can't seem to progress on, in order for the size to be calculated, it must factor in the checksum elements as well. The user shouldnt have to enter elements for the size, or checksum. The way the code is now, you have to enter the last two checksum elements in order for the size to be correct.
07-10-2012 10:38 AM
So I guess the way it would be is...
User enters data
calculate checksum
calculate size
add header
send out
07-10-2012 10:39 AM
The checksum should be a default size of 1 byte or 2 byte or whatever.
That should be known ahead of time.
07-10-2012 11:23 AM
Checksum has a low and high byte, so 2 bytes right?
07-10-2012 11:29 AM - edited 07-10-2012 11:30 AM
Correct. Since we know the checksum has 2 bytes, simply add 2 to the array size before adding it to the array.
07-10-2012 11:43 AM
I see. So what's happening is:
Data is entered, then finds array size and adds 2 elements to it, then splits it to get our high/low bytes, then the header, data, and checksum are built into the array, and sent out.
07-10-2012 12:13 PM
@Demetri90 wrote:
I see. So what's happening is:
Data is entered, then finds array size and adds 2 elements to it, then splits it to get our high/low bytes, then the header, data, and checksum are built into the array, and sent out.
Exactly! And as you already know, you have to convert the byte array into a string so you can send it out of the COM port.
07-10-2012 12:41 PM
Awesome, my uncle (the engineer) was using it and everything seems to be working so far. Is it possible to have a toggle switch trigger a set of commands to send to the board? We have an led on the board but it takes a few commands to get it lit/un lit. I just want to be able to flick a switch on Labview and have it turn on/off.
07-11-2012 07:12 AM - edited 07-11-2012 07:13 AM
Look into the event structure. You will want the Value Change event for your button.