This is just a code that I'm trying to use with AVRStudio 4 in C but it doesn't compile. What is wrong with it?
I simply want to read PINB and map it to PORTA, like this: PORTA = PINB;
However, I get like 4 errors. What's wrong? (this code is not originally mine).
/********************************************************************************
Includes
********************************************************************************/
#include <avr/io.h>
#include <stdbool.h>
/********************************************************************************
Main
********************************************************************************/
int main(void) {
// configure PORTA as output
DDRA = 0xFF;
// configure PORTB as input
DDRB = 0;
// make sure PORTB is high impedance and will not source
PORTB = 0;
// main loop
while (true) {
// map PINB switches to PORTA
PORTA = PINB;
}
}