Configures the device UART for asynchronous communication. Communication is in the common 8/n/1 format. Similar to RS232, except that the logic is normal CMOS/TTL. Connection to an RS232 device will require a converter chip such as the MAX233, which inverts the logic and shifts the voltage levels.
The TX (transmit) and RX (receive) lines appear on FIO/EIO after any timers and counters.
-
U3: Requires U3 hardware version 1.21+. On hardware version 1.30 the TX (transmit) and RX (receive) lines appear on FIO/EIO after any timers and counters, so with no timers/counters enabled, and pin offset set to 4, TX=FIO4 and RX=FIO5. On hardware version 1.21, the UART uses SDA for TX and SCL for RX.
-
UE9: The UE9 has a UART available that supports asynchronous serial communication. The UART connects to the PIN2/PIN20 (TX0/RX0) pins on the DB37 connector.
|
Command: |
|
|
|
Byte |
|
|
|
0 |
Checksum8 |
|
|
1 |
0xF8 |
|
|
2 |
0x02 |
|
|
3 |
0x14 |
|
|
4 |
Checksum16 (LSB) |
|
|
5 |
Checksum16 (MSB) |
|
|
6 |
0x00 |
|
|
7 |
AsynchOptions |
|
|
|
|
Bit 7: Update |
|
|
|
Bit 6 :UARTEnable |
|
|
|
Bit 5: Reserved |
|
8-9 |
BaudFactor16 |
|
|
|
|
|
|
|
|
|
|
Response: |
|
|
|
Byte |
|
|
|
0 |
Checksum8 |
|
|
1 |
0xF8 |
|
|
2 |
0x02 |
|
|
3 |
0x14 |
|
|
4 |
Checksum16 (LSB) |
|
|
5 |
Checksum16 (MSB) |
|
|
6 |
Errorcode |
|
|
7 |
AsynchOptions |
|
|
8-9 |
BaudFactor16 |
|
-
AsynchOptions:
Bit 7: UpdateIf true, the new parameters are written (otherwise just a read is done).
Bit 6: UARTEnableIf true, the UART module is enabled. Note that no data can be transfered until pins have been assigned to the UART module using the ConfigIO function. -
BaudFactor16: This 16-bit value sets the baud rate according the following formula:
BaudFactor16 = 2^16 - ClockSpeed/(2 * Desired Baud)
The U3 and U6 clock speed is 48000000Hz, the UE9 clock speed is 3000000Hz. For example, a BaudFactor16 = 63036 provides a baud rate of 9600 bps on the U6 and U3.
U3 hardware version 1.21 only: the baud value is only 8-bit (8-bit baud value in command/response byte 9) and the formula is:
BaudFactor8 = 2^8 – TimerClockBase/(Desired Baud)