From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

type cast? can't find any information on this. please enlighten.

hello,

i am working on a program that will read back data in the form of an array of hex values. i am basically writing data to some EEPROM and then reading it back. I am sending the data as hex and reading it back as well. I need to be able to work with this data but i am having trouble. as i understand, i can use typecast to manipulate the data after i have read it back. can someone post an example of how to use the type cast and exactly what i need to put into each of the parameters on the typecast module? some examples of data that i want to write is some dollar values, a secret seed type hex value and some kind of account number. i want to be able to input these values, convert them to hex and send it to the memory, and then read it back from the memory and convert it back to the formats i sent in. im guessing there is a string to hex type vi?

i can post some of my code later tonight as i don't have it with me right now but if someone could post an example of doing something like this, i would really appreciate it. my project is due next week and there is much work to be done.

thanks
0 Kudos
Message 1 of 7
(2,628 Views)
"hex" is a display format and does not tell us anything about the underlying data. Everything can be shown as "hex" in some way or another, so don't confuse things.
 
If you say "hex" you probably simply mean a series of bytes. This is typically a string and since there could be non-printable characters (one character per byte), you would set the display to hex in order to actually be able to read it. Don't confuse this with a hexadecimal formatted set of bytes, which would consist of the characters 0...F exclusively, one byte character for each nibble.
 
Here is a recent example how to typcast some arbitrary data (e.g. a cluster) to a string and later take the string and cast it back to to what you originally had.
 
 
See if this gives you some ideas. 😄
0 Kudos
Message 2 of 7
(2,619 Views)
OK this is the same person as the original post.

the data i write to the memory is 4 bytes of unsigned byte 8 bit integer. this is also what is read back.

i would like to be able to write a string of characters or numbers and convert it to this U8 byte, write it to memory and read it back, and convert back to the string of characters or numbers.

is there something built in that will do this conversion of string to U8?

for instance,

i want to be able to type a word, such as hello and a number like 1.5 into a field, convert it into a 4 byte U8 array and then once i read that data back as a U8 array, convert it back to the word hello and number 1.5.


0 Kudos
Message 3 of 7
(2,600 Views)



ok so for instance in this image, this doesn't do what i want but it hopefully will convey my intent.i want to have a string of characters that i input, convert that to the 4 byte U8 array that i need to write to my memory. then once i read that back, i need to convert it back to the string of characters. how do i do this?
0 Kudos
Message 4 of 7
(2,586 Views)

You cannot convert a string "hello" (which is 5 bytes) into a single byte, or into a 4byte U8 array. Doesn't fit! 😄

How do you write to your "memory"? VI? DLL?

Message 5 of 7
(2,584 Views)
is there some way i can communicate with you via instant messaging software or irc?
0 Kudos
Message 6 of 7
(2,574 Views)

jjeun wrote:
is there some way i can communicate with you via instant messaging software or irc?

 

This is a long thread with several participants. Who do you mean by "you"? 😄

 

(The thread is also older than one year)

0 Kudos
Message 7 of 7
(2,287 Views)