Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 69015

Add Array Elements gives wrong answer

$
0
0

Back again. I'm performing VISA serial read/writes using strings. I need to include a checksum each time I write a command.

After searching around I thought I could input a string into a byte array and this does do the ascii to number conversion.

 

The problem I'm having is when I pass the byte array to the Add Array Elements function the result is wrong. For example if I

were to take a command, #0%PVR,1^ I would expect 555 as the result but instead I'm seeing 43. Likewise if I form a command

#0%XXX,1^ I would expect 571 as the checksum but instead I get 59. However many times I loop at least the wrong numbers

are incrementing by one.

 

Attaching the byte array to an Index Array and watching every index, the ascii conversion in each element of the byte array is correct.

 

As is the byte array length.

 

Q1: Does anyone know what I'm doing wrong (seems like a straight forward function?

Q2: I haven't been able to get For Loop to work to do the summation (curse of being a newbie), any ideas on what that would look like?

 

Pardon the vi, it is pretty crude.

 

Thanks,

Dave  

 


Viewing all articles
Browse latest Browse all 69015

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>