LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

unsigned bytes

Solved!
Go to solution

Hello All,

 

i have a 3 different strings of Ascii  which i want to convert into Hex with a Checksum,

 

however i think i have gone wrong somewhere,

 

if i have one of my strings as a U8 and the others as U16 and U32 my byte array will not add the elements together, unless i

 

make all of them them a U32 (which i dont want) as i will have extra 0s padding my string, when i put them together

 

can someone help me with this please.

 

Thanks in advance

 

Thomas

0 Kudos
Message 1 of 12
(5,672 Views)

Hi Thomas,

 

you really should attach an example of your "strings having them as U8/U16/U32". No idea what you're talking about...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(5,671 Views)

Post your VI friend (2011) with your required input.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 3 of 12
(5,667 Views)

on the front panel i have Addr Data and command Data needs to be of a variable length however read/write only needs to be a Unsigned 8 i dont want any zeros in the concatnated string but when if i do this i can bnot add the elements in the array for the checksum

0 Kudos
Message 4 of 12
(5,662 Views)

also i know there are  alot of things that dont need to be there they are only there for my purposes only and will be remove one i have it working!!

 

0 Kudos
Message 5 of 12
(5,658 Views)

Hi Thomas,

 

can you also give some typical data?

 

It doesn't seem to be useful to typecast some strings to convert them back to strings to again convert them to an array of numbers to decimate that array. Seems not useful at all...

 

So we need:

- typical data for "addr", "status" and "Data"

- result needed for those data

- formula for your checksum calculation

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 12
(5,656 Views)

addr ="xxxx"

data= is variable length

status= 4 Ascii caracters

read/write=r or w

checksum= sum of all above in hex or with 80hex

0 Kudos
Message 7 of 12
(5,648 Views)

checksum= sum of all above ORed with 80hex

0 Kudos
Message 8 of 12
(5,647 Views)
Solution
Accepted by topic author thomasd6

Hi Thomas,

 

you have been asked to provide some real data and the needed output, but have failed to...

 

Just a rough sketch:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 12
(5,638 Views)

thanks GerdW  one quick question i see that you ff anded with the result could you explain that to me please,

 

it works like a dream!! i didnt even know that i had a add array element function 

0 Kudos
Message 10 of 12
(5,631 Views)