I have a robot which used a AtMega 328/L 40pin until recently when I needed more resources, so I moved to the Atmega 644p.
The registers and bit names are different between the two and to be honest I just cannot get the new one to work properly. I am certain I have followed the changes as stated in the datasheet, but feel that my lack of knowledge in standing in the way.
Here is the 328 function that did work:
portInit(); // Setup port directions and initial values.
// This is the most important step!
cli(); // Disable global interrupts.
UBRRH = UBRR_BAUD_LOW >> 8; // Setup UART: Baud is Low Speed
UBRRL = (uint8_t) UBRR_BAUD_LOW;
UCSRA = 0x00;
UCSRC = (1<> 8; // Setup UART: Baud is Low Speed
//UBRR0L = (uint8_t) UBRR_BAUD_LOW;
//UCSR0A = 0x00;
//UCSR0C = ((1<What doesn't work about it and how do you know/what do you look for to know that it does not work? Have you tried a completely fresh test project where you just set up the peripheral you want to use so you can figure out how it is supposed to be set up? PS, I added the embedded tag.
以上就是Migrating from AtMega328 to AtMega644p的详细内容，更多请关注web前端其它相关文章！