📄 pcl4c.ref
字号:
PCL4C Reference Manual Page 8
SioDCD
Function Reads the Data Carrier Detect (DCD) modem status bit.
Syntax int SioDCD(Port)
int Port; /* Port selected (COM1 thru COM4) */
Remarks The SioDCD function is used to read the Data Carrier
Detect (DCD) modem status bit. Also see SioModem.
Returns -2 : Port not enabled. Call SioReset first.
-4 : No such port. Expect 0 to MaxPort.
0 : DCD is clear.
>0 : DCD is set.
Example /* test data carrier status bit */
if(SioDCD(Port))
puts("Carrier is on");
else puts("Carrier is off");
See Also SioDSR, SioCTS, SioRI, and SioModem.
PCL4C Reference Manual Page 9
SioDelay
Function Delays one or more timer tics.
Syntax int SioDelay(tics)
int tics; /* # tics */
Remarks The SioDelay function is used to delay one or more
timer tics, where each timer tic is approximately 55
milliseconds (18.2 tics to the second).
Returns zero
Example /* delay 5 seconds */
SioDelay(5*18);
See Also SioTimer
PCL4C Reference Manual Page 10
SioDone
Function Terminates further serial processing.
Syntax int SioDone(Port)
int Port; /* Port selected (COM1 thru COM4) */
Remarks The SioDone function terminates further serial
processing. SioDone MUST be called before exiting your
application so that interrupts can be restored to
their original state. Failure to do this can crash
the operating system. If you forget to call SioDone
before exiting, be sure to re-boot your computer. You
can call SioDone even if SioReset has not been called,
so it is good practice to always call SioDone before
exiting your application.
Also note that SioDone dereferences the transmit and
receive buffers set up by SioRxQue and SioTxQue.
Returns -2 : Port not enabled. Call SioReset first.
-4 : No such port. Expect 0 to MaxPort.
Example /* terminate processing for COM3 */
SioDone(COM3);
See Also SioReset.
PCL4C Reference Manual Page 11
SioDSR
Function Reads the Data Set Ready (DSR) modem status bit.
Syntax int SioDSR(Port)
int Port; /* Port selected (COM1 thru COM4) */
Remarks The SioDSR function is used to read the Data Set Ready
(DSR) modem status bit.
Returns -2 : Port not enabled. Call SioReset first.
-4 : No such port. Expect 0 to MaxPort.
0 : DSR is clear.
>0 : DSR is set
Example /* read DSR status bit */
if(SioDSR(Port))
puts("Modem is ready");
else puts("Modem is not ready");
See Also SioCTS, SioRI, SioDCD, and SioModem
PCL4C Reference Manual Page 12
SioDTR
Function Set, clear, or read the Data Terminal Ready (DTR) bit.
Syntax int SioDTR(Port,Cmd)
int Port; /* Port selected (COM1 thru COM4) */
char Cmd; /* DTR command (SET, CLEAR, or READ) */
Remarks The SioDTR function controls the Data Terminal Ready
(DTR) bit in the modem control register. Commands
(defined in PCL4C.H) are:
SET_LINE ('S') to set DTR (ON)
CLEAR_LINE ('C') to clear DTR (OFF)
READ_LINE ('R') to read DTR
Returns -2 : Port not enabled. Call SioReset first.
-4 : No such port. Expect 0 to MaxPort.
-5 : Not one of 'S', 'C', or 'R'.
0 : DTR is OFF (READ_LINE Command).
>0 : DTR is ON (READ_LINE Command).
Example /* turn DTR on for modem connected to COM4 */
SioDTR(COM4,SET);
See Also SioRTS.
PCL4C Reference Manual Page 13
SioError
Function Displays error in text.
Syntax int SioError(Code)
int Code; /* Error code returned from */
/* a PCL4C function */
Remarks The SioError function displays the error in text
corresponding to the error code. During development
of a communications application, it is a good idea to
always test return codes, and print out their
descriptions with SioError.
Returns zero
Example code = SioReset(Port,Baud4800);
/* display error message if error occurred */
if(code<0) SioError(code);
PCL4C Reference Manual Page 14
SioFIFO
Function Sets the FIFO trigger level (INS16550 only).
Syntax int SioFIFO(Port,LevelCode)
int Port; /* Port selected (COM1 thru COM4) */
int LevelCode; /* FIFO level code (see below) */
Remarks The SioFIFO function is used to set the trigger level
at which interrupts are generated. For example, if the
FIFO level is set to 8, then the INS16550 UART will
not generate an interrupt until 8 bytes have been
received. This reduces the number of interrupts
generated and allows faster processing with slower
machines or when running simultaneous ports.
In order to test if your port is a INS16550, call
SioFIFO with a LevelCode of other than FIFO_OFF.
SioFIFO can be called for the INS8250/16450 without
ill effect.
Code PCL4C.H Name Trigger Level
-1 FIFO_OFF Disable FIFO
0 LEVEL_1 1 byte
1 LEVEL_4 4 bytes
2 LEVEL_8 8 bytes
3 LEVEL_14 14 bytes
Returns -2 : Port not enabled. Call SioReset first.
-4 : No such port. Expect 0 to MaxPort.
>0 : FIFO level set.
0 : FIFO level not set (not INS16550).
Example /* Set FIFO level to 8 */
if( SioFIFO(Port,LEVEL_8) ) printf("FIFO reset\n");
else printf("UART in not INS16550\n");
PCL4C Reference Manual Page 15
SioFlow
Function Sets hardware (RTS/CTS) flow control.
Syntax int SioFlow(Port,Tics)
int Port; /* Port selected (COM1 thru COM4) */
int Tics; /* SioPutc timeout tics */
Remarks The SioFlow function is used to enable or disable
hardware flow control. Hardware flow control uses RTS
and CTS to control data flow between the modem and the
computer. Refer to the User's Manual for a discussion
of flow control. To enable hardware flow control,
call SioFlow with Tics > 0.
"Tics" is the number of timer tics (18 per second)
before a call to SioPutc will time out because the
modem dropped CTS.
In order for hardware flow control to work correctly,
your modem must also be configured to work with
hardware flow control, and your computer to modem
cable must have RTS and CTS wired straight through. If
you enable hardware flow control, do not modify the
RTS line (by calling SioRTS) unless you know exactly
what you are doing.
Flow control is disabled after resetting a port. To
explicitly disable hardware flow control, call SioFlow
with Tics = -1.
Returns -2 : Port not enabled. Call SioReset first.
-4 : No such port. Expect 0 to MaxPort.
=0 : Flow control disabled.
>0 : Flow control enabled.
Example /* Enable flow control on COM1 */
Code = SioFlow(COM1,18);
if(Code>0) printf("Flow Control enabled\n");
else SioError(Code);
/* disable flow control on COM2 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -