Discussion:
Reading serial strings from the serial port and saving to a text file in Hexidecimal form.
(too old to reply)
Duuce
2008-08-13 05:40:21 UTC
Permalink
I am able to send 32 uniques binary bytes as a string (not ASCII) via the serial port but I am unable to Read the binary string from the serial port and store the string as hexidecimal values in a text file? For example, I can generate a binary string (0000111100001111), but how can I store it as a hexidecimal value in a text file with a carriage return so the format is:
 
0F
0F
 
Attached is my code so far. 


Unique Serial READ WRITE.vi:
http://forums.ni.com/attachments/ni/170/348873/1/Unique Serial READ WRITE.vi
muks
2008-08-13 06:40:06 UTC
Permalink
<img src="Loading Image..."><img src="Loading Image..."> <img src="Loading Image..."> Message Edited by muks on 08-13-2008 01:34 AM


format.PNG:
http://forums.ni.com/attachments/ni/170/348883/1/format.PNG


bd.PNG:
http://forums.ni.com/attachments/ni/170/348883/2/bd.PNG


expln.PNG:
http://forums.ni.com/attachments/ni/170/348883/3/expln.PNG
muks
2008-08-13 06:40:07 UTC
Permalink
<img src="Loading Image..."> Message Edited by muks on 08-13-2008 01:36 AM


fp.PNG:
http://forums.ni.com/attachments/ni/170/348885/1/fp.PNG
muks
2008-08-13 06:40:07 UTC
Permalink
Can you post your code for lv 8.0?
Duuce
2008-08-13 16:10:06 UTC
Permalink
I've attached my code in LabVIEW 8.0 and added some notes in the code to better explain my application. Keep in mind, it is sending and recieving on the same serial port (simple loopback test).


Unique Serial READ WRITE LV8.vi:
http://forums.ni.com/ni/attachments/ni/170/349015/1/Unique Serial READ WRITE LV8.vi
muks
2008-08-14 08:10:07 UTC
Permalink
Did my above explanation help u?
muks
2008-08-14 08:10:09 UTC
Permalink
<img src="Loading Image..." border="0">The vi u attached is not for 8.0 it is for 8.5. Message Edited by muks on 08-14-2008 02:44 AM


save.PNG:
http://forums.ni.com/ni/attachments/ni/170/349223/1/save.PNG
Duuce
2008-08-15 17:10:10 UTC
Permalink
I tried saving this vi in 8.0 again. Please verify if it is correct. Nothing has worked so far. I would just like to capture a string of binary values (32 bytes) from the serial port, convert and store them as hexidecimal characters in a text file. So, a string read from the serial port (00000000000000010000001000000011.......00011111) would look like the following when stored as a text file:&nbsp;000102......1F &nbsp;Any help is greatly appreciated.


Unique Serial READ WRITE LV8.vi:
http://forums.ni.com/ni/attachments/ni/170/349666/1/Unique Serial READ WRITE LV8.vi
Dennis Knutson
2008-08-15 18:40:05 UTC
Permalink
You haven't posted anything that you have tried so far but try the code that is in the image below. I'm sure that there is several other ways to do this.&nbsp;Please not that you are not able to view the received data as binary. If you create a string indicator on the VISA Read, right click on it and select Hex Display.


Save Data as Hex.PNG:
http://forums.ni.com/ni/attachments/ni/170/349686/1/Save Data as Hex.PNG
Loading...