179
C-Control Pro Mega Series
© 2008 Conrad Electronic
6.15.4 Serial_Init_IRQ
Serial Functions
Syntax
void Serial_Init_IRQ(byte serport,byte ramaddr[],byte recvlen,byte sendlen,byte par,byte div);
Sub Serial_Init_IRQ(serport As Byte,ByRef ramaddr As Byte,recvlen As Byte,sendlen As Byte,
par As Byte,div As Byte)
Description
The serial interface gets initialized for usage in interrupt mode. The user has to provide a global variable
as a serial buffer. This buffer services as a storage for the data that is sent to the serial interface and is
received from it. The size of the buffer must be length of the send buffer plus the length of the receive
buffer plus 6 bytes (see
The maximum value for the size of the send and the receive buffer is 255 bytes each. 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.
() if you work in serial IRQ mode. Serial_Read() only supports polled
mode.
Parameter
serport interface number (0 = 1st serial port, 1 = 2nd serial port, ...)
ramaddr
address of the buffer
recvlen
size of receive buffer
sendlen
size of send buffer
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
Содержание C-Control Pro Mega Series
Страница 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Страница 9: ...VIII Inhalt 2008 Conrad Electronic ...
Страница 10: ...Part 1 ...
Страница 17: ...Part 2 ...
Страница 23: ...Part 3 ...
Страница 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Страница 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Страница 58: ...Part 4 ...
Страница 91: ...82 IDE 2008 Conrad Electronic ...
Страница 92: ...Part 5 ...
Страница 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Страница 136: ...Part 6 ...
Страница 231: ...Part 7 ...
Страница 240: ......