nrmlguru
Newbie level 4
Hello,
I have the following code.
I want to define a PORTA at address 0x80;
and then write an 8 bit data to PORTA.
I am not getting the expected result.
typedef union {
byte Byte;
struct {
byte BIT0 :1;
byte BIT1 :1;
byte BIT2 :1;
byte BIT3 :1;
byte BIT4 :1;
byte BIT5 :1;
byte BIT6 :1;
byte BIT7 :1;
} Bits;
} PORTASTR;
PORTASTR *_PORTA=(PORTASTR *)0x80;
#define PORTA _PORTA->Byte
void main()
{
unsigned int i;
while(1)
{
for(i=1000; i>0; i--);
PORTA = 0xFF;
for(i=1000; i>0; i--);
PORTA = 0x00;
}
}
I have the following code.
I want to define a PORTA at address 0x80;
and then write an 8 bit data to PORTA.
I am not getting the expected result.
typedef union {
byte Byte;
struct {
byte BIT0 :1;
byte BIT1 :1;
byte BIT2 :1;
byte BIT3 :1;
byte BIT4 :1;
byte BIT5 :1;
byte BIT6 :1;
byte BIT7 :1;
} Bits;
} PORTASTR;
PORTASTR *_PORTA=(PORTASTR *)0x80;
#define PORTA _PORTA->Byte
void main()
{
unsigned int i;
while(1)
{
for(i=1000; i>0; i--);
PORTA = 0xFF;
for(i=1000; i>0; i--);
PORTA = 0x00;
}
}