Mzz.. Only seems to compile for the Atmega328P
Anybody got more UART code for the Atmega16A ?
There isn't a uniform nomenclature for the different peripherals across different controller families. This means one has to confirm the register names, capabilities and bit settings for each controller type. When using a hardware abstraction layer library (e.g. Arduino), these details are hidden inside the libraries. FPC doesn't supply a HAL, only the controller specific definitions, so the user needs to take care of these differences.
For example the differences in nomenclature between atmega328P and atmega16A timer registers:
Atmega328P | Atmega16A |
UDR0 | UDR |
UCSRA0 | UCSRA |
UCSRB0 | UCSRB |
UCSRC0 | UCSRC |
UBRR0L | UBRRL |
UBRR0H | UBRRH |
Also the different controllers may have different capabilities and bit fields in the registers may be in different positions, so always refer to the datasheets for the specific controller to ensure the correct settings for that particular controller model is used. An example of this is that the 328P has a master SPI mode for the USART, while the 16A doesn't. This is important to know, because it means that bit 7 of the UCSRCx register has a different meaning for these two controllers, while bits 6 - 0 have identical meaning.
BTW does FPC-AVR suppport PWM signals or do i have to loop myself?
FPC doesn't have a a HAL library, so one has to either use and configure a hardware timer for PWM mode, or write your own software bitbang PWM code loop.