![background image](http://html.mh-extra.com/html/conrad/c-control-pro-mega-series/c-control-pro-mega-series_manual_2654183187.webp)
178
Libraries
© 2008 Conrad Electronic
6.15.3 Serial_Init
Serial Functions
Syntax
void Serial_Init(byte serport,byte par,byte divider);
Sub Serial_Init(serport As Byte,par As Byte,divider As Byte)
Description
The serial interface gets initialized. The parameter par is defined through successive or-ing of predefined
bit values. The values of character length, stop bits and parity are or'd together. E.g. "SR_7BIT | SR_2STOP
| SR_EVEN_PAR" means 7 bit character length, 2 stop bits and even parity (see
). An example in
BASIC Syntax: "SR_7BIT Or SR_2STOP Or SR_EVEN_PAR". The baud rate is defined as a divider value
(see divider table).
It is possible to activate the DoubleClock Mode of the Atmel AVR. This happens if the Hi-bit of the
divider is set. In DoubleClock mode the normal value from the divider table must be doubled to get the
same baudrate. This has the advantage that baudrates, that have no exact divider value can be
represented. E.g. MIDI: The new value SB_MIDI (=0x803a) lies much nearer at the correct value of
31250baud. An example for 19200 baud: The normal divider value for 19200 baud is 0x002f. If
DoubleClock Mode is used, the divider must be doubled (=0x005e). Then set the Hi-bit, and the alternative
divider value for 19200 baud is 0x805e.
Parameter
serport interface number (0 = 1st serial port, 1 = 2nd serial port, ...)
par
interface parameter (see par table)
divider
table par definitions:
Definition
Function
SR_5BIT
5 Bit char length
SR_6BIT
6 Bit char length
SR_7BIT
7 Bit char length
SR_8BIT
8 Bit char length
SR_1STOP
1 stop bit
SR_2STOP
2 stop bit
SR_NO_PAR
no parity
SR_EVEN_PAR
even parity
SR_ODD_PAR
odd parity
Summary of Contents for C-Control Pro Mega Series
Page 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Page 9: ...VIII Inhalt 2008 Conrad Electronic ...
Page 10: ...Part 1 ...
Page 17: ...Part 2 ...
Page 23: ...Part 3 ...
Page 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Page 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Page 58: ...Part 4 ...
Page 91: ...82 IDE 2008 Conrad Electronic ...
Page 92: ...Part 5 ...
Page 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Page 136: ...Part 6 ...
Page 231: ...Part 7 ...
Page 240: ......