LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading in a binary file and displaying an array correctly

I am teaching myself Labview 7.1 and what I am trying to do is read in a text file of binary digits 10011001, 11011101 etc and then output these to a series of leds (boolean array) as well as to another array to display what was read in. I can get this to happen when I format the text file as 1,0,0,1,1,0,0,1 but then the array is 1 column by 8 rows (is this a 1by8 array) I want to read this data in as 10011001 displayed on 1 row and then the next row of the array to be 11011101, it displays 11111111 if I go above 3 digits, I know this is just a problem with binary versus decimal numbers, how can I format the input file so it is read in as 8-bit binary?

Thank you in advance,
Dan Ziehm
0 Kudos
Message 1 of 4
(2,755 Views)
If you use a function like Read From Spreadsheet File, use a format string of %b. By default, the function will return dbls but you can convert this to I32. For displaying binary on the front panel, right click on the indicator and select Format & Precision. Select Binary. You can also turn on minimum field width and choose to pad with zeros on the left. This is needed if you have a binary value of say 0111 and want it to display that way instead of just 111.
Message 2 of 4
(2,745 Views)
Read the text file as string, then pass it through "spreadsheet string to array" with "," as delimiter, %b as format and an U8 array as type. I made a quick demo, see attached code image.
Message 3 of 4
(2,742 Views)
thank you, I am working on reading the info in from the file I think I have got it I will post my code when it is done.

Thanks again,
Dan
Message 4 of 4
(2,727 Views)