176
Libraries
© 2008 Conrad Electronic
...
...
PortF.7
47
PortG.0
48
...
...
PortG.4
52
6.14.7 Port Example
// Program toggles the LED's on the applicationboard
// alternately every second
void main(void)
{
Port_DataDirBit(PORT_LED2,PORT_OUT);
while(true)
// endless loop
{
Port_WriteBit(PORT_LED2,PORT_OFF);
AbsDelay(
1000
);
Port_WriteBit(PORT_LED1,PORT_OFF);
Port_WriteBit(PORT_LED2,PORT_ON);
AbsDelay(
1000
);
}
}
6.15
RS232
The serial interface can be operated at speeds of up to 230.4 kilo baud. With the functions for the
serial interface the first parameter will indicate the port number (0 or 1). Mega32 does only provide
one serial interface (0), while Mega128 does provide two (0, 1).
6.15.1 Divider
The functions
get a divider value as baudrate parameter. The
baudrate is derived from the processor clock (14,7456 MHz).
According to the Atmel processor handbook the following formula is used to calculate the divider for
a specified baudrate:
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: ......