National Instruments 320682C Musical Toy Instrument User Manual


 
Chapter 5 RS-232 Library
© National Instruments Corporation 5-33 LabWindows/CVI Standard Libraries
for an acknowledgment before it re-sends the current packet. When LabWindows/CVI plays the
role of receiver, it waits for up to waitPeriod seconds for the next packet after it sends out an
acknowledgment for the current packet. If it does not receive the next packet within delayPeriod
seconds, it re-sends the acknowledgment, and waits again, up to maximum#ofRetries times. The
default value of waitPeriod is 10.0.
packetSize sets the packet size in bytes. Its value must be less than or equal to the input and
queue sizes. The standard XModem protocol defines packet sizes to be 128 or 1024. If you are
using any other size, make sure the two communication parties understand each other. The
default value of packetSize is 128.
Using This Function
For transfers with a large packet size and a low baud rate, a large delay period is recommended.
XModemReceive
int result = XModemReceive (int COMPort, char fileName[]);
Purpose
Receives packets of information over the com port specified by COMPort and writes the packets
to the specified file.
Parameters
Input
COMPort
integer Range 1 through 32.
fileName
string Contains the pathname.
Return Value
result
integer Result of the XModem receive
operation.
<0
Failure.
0
Success.
Using This Function
This function uses the XModem file transfer protocol. The transmitter must also follow this
protocol for this function to work properly.
The Xmodem protocol requires that the sender and receiver agree on the error checking protocol.
This agreement is negotiated at the beginning of the transfer, and can cause a significant delay.