04-04-2018 12:45 PM
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.
Solved! Go to Solution.
04-04-2018 01:00 PM
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?
04-04-2018 01:21 PM
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?
04-04-2018 02:44 PM - edited 04-04-2018 02:46 PM
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.
04-04-2018 02:56 PM
@WDancer wrote:
I want the byte order to be FIFO
Byte order is either big or little endian. FIFO is not a byte order.
04-04-2018 02:58 PM
Sorry, Big-Endian
04-04-2018 03:19 PM
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.
04-04-2018 04:43 PM - edited 04-04-2018 04:49 PM
Equivalent code would be: