Instructions
318Libraries
© 2013 Conrad Electronic
31
SR_BDMIDI
31250bps
25
SR_BD38400
38400bps
8022 (Hex)
SR_BD57600
57600bps
12
SR_BD76800
76800bps
6
SR_BD125000
125000bps
3
SR_BD250000
250000bps
5.20.2 Serial_Disable
Serial Functions
Syntax
void Serial_Disable(byte serport);
Sub Serial_Disable(serport As Byte)
Description
The serial interface gets switched off and the corresponding ports can be used otherwise.
Parameter
serport interface number (0 = 1st serial port, 1 = 2nd serial port, ...)
5.20.3 Serial_Init (Mega)
Serial Functions Example
Syntax
void Serial_Init(byte serport, byte par, word divider);
Sub Serial_Init(serport As Byte, par As Byte, divider As Word)
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 Example). 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).
There is a chance to miss received characters when using the polled serial routines, especially at
high baud rates. If this is an issue, please use the interrupt driven serial routines with Serial_Init_IRQ() in-
stead of Serial_Init().
It is possible to activate the DoubleClock Mode of the Atmel AVR. This happens if the Hi-bit of the di-
vider is set. In DoubleClock mode the normal value from the divider table must be doubled to get the same