12-12-2014 11:08 AM
Hello crossrulz
7B 7B and 7D 7D indicate the begining and end of the frame respectivelly. In other VI i identify that charaters and eliminate. My problem is how i manipulate the data. The data arrive in decimal and i must sum all data to verify the checksum. I'm not able to get that. I think that i must convert dec to hex and in the end convert to double to apply expressions that i must work with. I think that you understand my doubt but i can get it. Even with your and other examples it doesn't work.
Thank you very much for all the support
12-12-2014 11:31 AM
My code assumes the {{ and }} are still there. If those are already removed, then it becomes a lot simpler. You can just use Delete From Array on your byte array. Do not wire the index or size. It defaults to deleting the last element, which just happens to be your checksum. So then use Add Array Elements on the output array and you can then compare it to the deleted element.
12-12-2014 11:47 AM
Here, this will parse your entire message, including the casting to double precision floating point numbers. Though, I question if your data are Big Endian or Little Endian (makes a huge difference in your data).
The Decimal vs Hexidecimal is just how the data is viewed. The data itself is not changing. I just find Hex easier to look at, especially since we are talking about the bytes.
12-12-2014 12:47 PM
Hello again
Look in the example in the attachment. I made equal but sum and CKS are not equal. Plus, The VI works if i converte previously the decimal data to hex and then paste it in my string indicator.
12-12-2014 01:29 PM
You are missing some data in your string.
7B7B A036 6F67 6E6C 6B6D 6C6C 6464 6464 0000 0104 0500 0000 0000 0007 6001 0000 0000 000A 3301 0000 3301 0117 0C00 CE7D 7D
01-21-2015 06:01 AM
Hi guys
This is how i made and work perfectly!
Thanks to all
01-21-2015 07:08 AM
You have some real Rube Goldbergs in there.
1. No need to figure out the index of the last element of the array. If you leave the index of the Delete From Array unwired, it automatically deletes the last element.
2. No need to even use Array Index in order to get the CRC out of the array. The Delete From Array has a second output called Deleted Element.
3. I have no clue why you are converting the U8 into a string just to take it back to a U8. What's wrong with just comparing the sumation directly?
01-21-2015 11:52 AM
Hi there
The CKS isn't always the same value! The brodcaste is diferent too. The data is on ASCII and i need the value of CKS to compare and the length is 255 bytes hence the U8 representation. The index from delete from array is n-1 (CKS) that i have to remove and then compare with the sume of the string without the CKS in the frame, that is a condition that I have to obey.
01-21-2015 02:23 PM
RuiZanzibar wrote: The index from delete from array is n-1 (CKS) that i have to remove and then compare with the sume of the string without the CKS in the frame, that is a condition that I have to obey.
Yeah, that is the last element. It would be the exact same if you left the index unwired.
01-23-2015 04:34 AM
Hello
I forgot to tell that i have a start (7B7B) and end (7D7D) frame in the broadcast, thats why the index must be (n-1).
Hugs