LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

files via serial port

I need to send a jpg file via serial port. Have anyone an idea how to get it. I am using LabView 6.0.
0 Kudos
Message 1 of 4
(2,493 Views)
Hi Francesc,
In order to solve this you will need:
- a null modem cable (the difference is that pin 2in goes to pin 3out and pin 3in goes to pin 2out)
- a normal serial communication VI (you can use the one in lv\examples)
- to pass the data you have to transform your array of bytes (your file) in string at sender and reverse this operation at receiver. THE ONLY PROBLEM is with ASCII character 11 (even if the receiver has all your bytes in buffer it seems that will return to you just those before ASCII 11). Thus, you will have to avoid the transmission of this character. An idea will be to split each byte from file in other two for transmission - for example its hex code (so, 11 will be transmitted as 0B ). Of course, this method doubles the number of transmit
ted bytes. If somebody found a better solution, please let me know.
good luck
0 Kudos
Message 2 of 4
(2,493 Views)
I checked the ASCII code table and it seems that character NL (ASCII 0A - new line) is the problem even if you can read it. I didn't try to read the serial port one more time after this character ... maybe the rest of the string will be there.
Also, pay attention to the packet length to match with port buffer size.
0 Kudos
Message 3 of 4
(2,493 Views)
For completeness, I made some tests and figure it out.
So,
- null modem cable
- set com port for 8 data bits
- set the buffer according to the string length (for one packet - you should divide the whole file in several packets)
- modify the receiver in order to avoid a NL character occurrence in the string : after reading the string, subtract its length from previous bytes on com port - if the result is more than 0 perform another read operation for remained bytes. In order to do it simpler, try to use VISA WRITE and READ from/to FILE VIs.
good luck
0 Kudos
Message 4 of 4
(2,493 Views)