From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Require to add elements of a byte array

Solved!
Go to solution

I have a byte array - meaning all the numbers are between 0 - 255. 

 

I need to add all of them in a binary/ hex addition format. Meaning the summation will still be an 8 bit number and stay between 0 - 255. The extra bit (9th bit) that is created with summation of two numbers will be ignored. 

 

Example: 254 + 254 = 508 in decimal summation

           254 + 254 = 253 in binary addition

Is there a way to solve this with a single vi, and not manually implementing the algorithm.

0 Kudos
Message 1 of 11
(4,281 Views)

How about this?

 

add.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 11
(4,270 Views)

True this works, but I am seeking an array addition of all elements, where I have like 20 elements.

 

IT is a byte array.

0 Kudos
Message 3 of 11
(4,268 Views)

Something like this?

add.PNG

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 11
(4,254 Views)

Hi RTSLVU

 

Not really, I want to add all the elements in a single array. For example the first array you have with eleemnts: 255 254 253 252 253 ; I want to add all those five and get the result to do manipulations with that later on in my code.

0 Kudos
Message 5 of 11
(4,252 Views)
Solution
Accepted by topic author looser_engineer

Ohh... Right off the top of my head I would do this...

add.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 11
(4,249 Views)
Solution
Accepted by topic author looser_engineer

or this...

Example_VI.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 7 of 11
(4,232 Views)

@RTSLVU wrote:

Ohh... Right off the top of my head I would do this...

add.PNG


Unless you initialize that shift register, surprises will happen 😮 Not good!

 

(yes, I would just go withe the "add array elements" above)

0 Kudos
Message 8 of 11
(4,218 Views)

You know I was looking for Add Array elements and for the life of me I could not find it in the pallette 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 9 of 11
(4,212 Views)

@RTSLVU wrote:

You know I was looking for Add Array elements and for the life of me I could not find it in the pallette 


Yes, it is surprising that it is NOT in the array palette :D.

0 Kudos
Message 10 of 11
(4,196 Views)