National Instruments 320682C Musical Toy Instrument User Manual


 
RS-232 Library Chapter 5
LabWindows/CVI Standard Libraries 5-26 © National Instruments Corporation
Return Value
result
integer Refer to error codes in Table 5-6.
Parameter Discussion
deviceName is the name of the com port in the ASCII string. For example, COM1 for com port 1
on Microsoft Windows using COMM.DRV, and /dev/ttya for com port 1 on UNIX using the
Zilog 8530 SCC serial comm driver.
If you pass a NULL pointer or an empty string for deviceName, the library uses the following
device names depending on the COM port number you have specified.
Port Number deviceName on Windows deviceName on UNIX
1 “COM1” “/dev/ttya”
2 “COM2’ “/dev/ttyb”
3 “COM3” “/dev/ttys1”
4 “COM4” “/dev/ttys2”
and so on
Using This Function
OpenCom uses 512 bytes of the buffer for the input queue, 512 bytes for the output. The
function assumes the default baud rate, parity, stop bits, data bits, port address, and handshake
mode established through the com port configuration of the operating system. The time-out for
I/O operations is 5 seconds. Refer to the functions SetXMode, SetCTSMode, and
SetComTime if you want to change these defaults.
OpenComConfig
int result = OpenComConfig (int COMPort, char deviceName[], long baudRate,
int parity, int dataBits, int stopBits,
int inputQueueSize, int outputQueueSize);
Purpose
Opens a com port, and sets port parameters as specified. If inputQueueSize or
outputQueueSize is between 1 and 29, it is forced to 30.