Home |
RTKernel-32 Programming Manual Function COMPortInit Function COMWaitSendBufferEmpty |
Function COMPortInitCOMPortInit initializes a port: void COMPortInit(int Port, long Baud, int Parity, int StopBits, int WordLength); COMPortInit sets the port parameters and disables interrupts for the port. If a 16550A UART is detected, its FIFO is automatically enabled at trigger level 8. ParametersPortMust be in the range 0 to COM_MAX_PORTS-1 (37). BaudBaud rate for the port. Supported baud rates range from 50 to 115200. ParityMust be set to PARITY_NONE, PARITY_ODD, PARITY_EVEN, PARITY_MARK, or PARITY_SPACE. StopBitsMay be set to 1 or 2. WordLengthMust be in the range 5 to 8. RTCom assumes the UART uses a clock input of 1.8432MHz (the value commonly used on PCs). If a different input clock frequency is used by the target hardware, the baud rate specified for COMPortInit must be adjusted according to the following formula: B = (1,843,200 / Clock Frequency) * Baudrate where B is the value to be supplied for COMPortInit and Baudrate is the effective baud rate to be used. Example:The target computer has a 386EX CPU running at 25Mhz and you want to use COM2 (the second internal serial port of the 386EX) at 57600 baud. The input frequency for the serial ports is CLK2 (50Mhz in this example) divided by 4, giving 12.5 MHz. The value required for COMPortInit is: (1.8432 / 12.5) * 57600 = 8493
|