#define PORTB_BASE_ADDR 0x23
#define PORTC_BASE_ADDR 0x26
#define PORTD_BASE_ADDR 0x29
struct port
{
uint8_t PINx;
uint8_t DDRx;
uint8_t PORTx;
};
//int var;
//int *ptr = &var;
//struct port s1;
struct port *gpiob = (struct port *)PORTB_BASE_ADDR;
struct port *gpioc = (struct port *)PORTC_BASE_ADDR;
struct port *gpiod = (struct port *)PORTD_BASE_ADDR;
void setup() {
// put your setup code here, to run once:
//var = 5;
// *ptr = 5;
// struct PORT *sptr;
// s1.PINx = 5;//dot variables
gpiob -> DDRx |= (1<<5);
// gpiob -> DDRBx = 5;
// gpiob -> PORTx = 5;
}
void loop() {
// put your main code here, to run repeatedly:
gpiob -> PORTx |= (1<<0);
delay(1000);
gpiob -> PORTx |= (1<<1);
delay(1000);
gpiob -> PORTx |= (1<<2);
delay(1000);
gpiob -> PORTx |= (1<<3);
//*((volatile uint8_t *)0x24) |= (1<<5);
delay(1000);
gpiob -> PORTx &= ~(1<<0);
delay(1000);
gpiob -> PORTx &= ~(1<<1);
delay(1000);
gpiob -> PORTx &= ~(1<<2);
delay(1000);
gpiob -> PORTx &= ~(1<<3);
//*((volatile uint8_t *)0x24) &= ~(1<<5);
delay(1000);
}