RTC
®
5 PC Interface Board
Rev. 1.9 e
10 Commands And Functions
394
Ctrl Command rs232_config
Function configures the RS232 interface for the specified baud rate.
Call
rs232_config( BaudRate )
Parameter
BaudRate
baud rate as an unsigned 32-bit value;
allowed value range: [300 … +115200]
Comments • The default value is 9600 baud.
• The other RS232 interface parameters cannot be altered (data bits: 8, start bits: 1, stop
bits: 1, parity: none).
• Also see "RS232 Interface", page 51.
RTC
®
4
RTC
®
5 new command
References rs232_write_data, rs232_read_data
Ctrl Command rs232_read_data
Function reads a value from the input buffer of the RS232 interface (see page 208).
Call
RS232Data = rs232_read_data()
Result unsigned 32-bit value:
Bit #0 (LSB) …
Bit #7
next (not yet read by the user program) value of the input buffer
Bit #8 “new” bit:
= 1: The value is new (was not previously read).
= 0: The value is old (was already read once by rs232_read_data).
Bits #9…#15 0
Bits #16…#23 Number of further (not yet read) characters
Bits #24…#31 Number of buffer overruns
Comments • The RS232 interface is internally read every 10 µs (one character at a time). This char-
acter, if new, is stored in a 256-character ring buffer that can be transferred to the user
program via rs232_read_data (asynchronously to reading).
•Byte#0 (bits#0
…#7) returns only one character from the current reading position.
• Byte #1 (bit #8) indicates if the character has already been read by the user program.
• Byte #2 (bits #16
…#23) indicates the number of characters in the input buffer that still
haven’t been read by the user program. If no unread characters are present (byte #2 =
0), then the most recently read character is transferred with “new bit” = 0.
• Byte #3 (bits #24
…#31) indicates the number of overruns of the input buffer (a corre-
sponding number of characters were overwritten and therefore irretrievably lost). To
reset the overrun counter, call rs232_read_data that many times.
• Example: return value 459098 = 0x0007015A = (0, 7, 1, 90) means: character 90 ('Z')
was read and is new (1), 7 additional characters remain to be read, the buffer was never
overrun (0).
RTC
®
4
RTC
®
5 new command
Version info Last change with version RBF 513
References rs232_write_data