LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write binary file with xmodem protocal by using NI VISA serial port

Hi All
 
Could someone advise me how do i call Hyperterminal in Labview or simulate the same function of Hyperterminal in Labview?
 
I need to to send a programming file to my device under test (DUT) through serial port. There is a function in Hyperterminal called "Send File" (see attached picture). I need to select Xmodem protocal before I send the file. Then I have to select the programming file (binary file) that I need to download to DUT and click Send in Hyperterminal. The file size is 954kb. 
 
How do i do this in Labview? Can i send a file through using the VISA write port vi? Do I need to read the file first then write it later? If Labview can't send a file, how should i call Hyperterminal and is there any shell function that can be used? Also, when I read this file (using binary file read vi), the data size I got is different from the Hyperterminal, The length of the data string is 976128 if I use the flatten vi.
 
Please kindly advise. Thanks
 
Best Regards,
Weny
0 Kudos
Message 1 of 10
(4,710 Views)

Look at the Serial Read and Write examples in LabVIEW for some ideas.  You don't want to use Write Port.  You want to use VISA Write to send data, and VISA Read to receive it.  You can certainly read the file in LabVIEW, then it is just a matter of using VISA Write to send parts of it at a time.  Since a file is probably too big to write all at once, you'll need to do it in a loop sending parts of it at a time.  I don't know what makes Xmodem protocol special, whether it is a way to encode bytes or to handle handshaking so you don't write data too fast before the receiver and read it.  What is on the other end of the serial connection that you are communicating with? 

 

I don't know what you mean by the file size being different.  976,128 bytes is 953.25 kB (divide by 1024).  That is very close to the 954 kB number you listed.

 

Also look at TCP/IP data server and client.  It will give some good ideas on how to send data.

 

 

0 Kudos
Message 2 of 10
(4,694 Views)
Hyperterminal does not have an automation interface so you would have to use an alternative such as HyperAccess (ActiveX) or implement the protocol yourself. It requires breaking the file into packets, adding a header and checksum, and handshaking each packet. Doable but tedious.
0 Kudos
Message 3 of 10
(4,683 Views)

Hi Dennis,

 

Thanks for the response. Just got back to the project again.

I have more questions about the hyperAccess:

Does HyperAccess has a llb that I can use? Does this have a send file function with modem protocal selection that I can use? I'm pretty new in this area. If possible, do you have an example?

 

Thanks a lot!!!

Weny

0 Kudos
Message 4 of 10
(4,641 Views)

No, it does not come with a LabVIEW driver. Yes, it has send file functions in it's DLL. I do not have an example, sorry. I used the ActiveX interface directly in TestStand so I never wrote any LabVIEW functions.

0 Kudos
Message 5 of 10
(4,637 Views)

Got it. Let me try. Thanks anyway!

 

Thank you guys very much for helping!!!

 

-Wen

0 Kudos
Message 6 of 10
(4,630 Views)

Hi,

 

   I too have the same requirement "Writing Binary file in XModem Protocol", Can you share any example vi for Xmodem protocol.

 

 

 

Thanks & Regards

E.SundarRajan

0 Kudos
Message 7 of 10
(4,512 Views)

I didn't make it work. I endup found a VB code of xmodem and build an exe and then using system Exec.vi to call it.

0 Kudos
Message 8 of 10
(4,500 Views)

Did you do a search for xmodem? You would have found a link to this.

0 Kudos
Message 9 of 10
(4,492 Views)

I got that. The problem I met is when I read my binary file in Labview, Labview added some extra Chars into it which messed up all the data. So I simply give up the whole thing and use vb instead.

0 Kudos
Message 10 of 10
(4,488 Views)