LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Incrementing a constant and storing in an array.

Solved!
Go to solution

I am trying to take a constant U64 input, output to a U8 array, append data to the beginning of the array, increment the starting number, then loop.  I have figured out converting from U64 to U8, but I am getting stuck on the rest and everything ends up as spaghetti.

0 Kudos
Message 1 of 8
(3,473 Views)
Solution
Accepted by topic author WDancer

You can actually save a step when typecasting. This part of your problem confuses me though: "append data to the beginning of the array, increment the starting number, then loop."

Can you give an example of input and expected output data?

Capture.PNG

Message 2 of 8
(3,471 Views)

Casting a U64 will give you 8 bytes, not four. "decimal" is a display convention and has nothing to do with the underlying data. (so please correct the label of your indicator).

 

A concatenating tunnel will append at the end, so if you want to append to the beginning (sic, also called pre-pend :D), it is not the right tool. I would just autoindex the U64 array, reverse, then cast to U8 at the end. How many iterations are you planning to do? What byte order do you want?

 

 

0 Kudos
Message 3 of 8
(3,459 Views)

I am programming a unique identifier on some I2C Flash ROMs and increment the ID sequentially.  Kind of like a serial number. The iterations are pulled from the quantity I want to burn at the time. I want the byte order to be FIFO

 

The data portion of my I2C imports from an array once my address and memory location is inputted.   The I2C part is working great, I am just trying to get the auto-increment of my ID to work.

 

 

Edit- I do not need to append data.  It is not necessary.

0 Kudos
Message 4 of 8
(3,436 Views)

@WDancer wrote:

I want the byte order to be FIFO

 


Byte order is either big or little endian. FIFO is not a byte order.

0 Kudos
Message 5 of 8
(3,428 Views)

Sorry, Big-Endian

0 Kudos
Message 6 of 8
(3,426 Views)

Okay, it looks like I got it now.  I forgot about the shift register function.  Thank you for the example, it kicked loose my creative block.

0 Kudos
Message 7 of 8
(3,419 Views)
  • "Iterations" should be an I32 integer (blue)
  • Try to avoid overlapping wires. Hard to edit.
  • I assume you do your other things inside that loop, currently you only see the value from the last iteration because the loop spins so fast.
  • As has been mentioned, you can cast directly to a U8 array. No need for any pink.
  • Instead of the shift register, you could just add the value of the index terminal to the start value (after conversion/coercion to U64. N (and i) is I32, so you cannot add more than 2^31 anyway.)

 

Equivalent code would be:

 

numbers.png

 

0 Kudos
Message 8 of 8
(3,279 Views)