This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Collect 8bit data from IO ports

I'm having a problem with collecting data from Port1. the variable ValueX has a value of FF, regardless of my input through the IO pins.With here i enclose partial of my code, any help or advice is highly appreciated, thank you!

sbit P1^0 BIT0; //these 8 ports will be input
.
.
.
.
sbit P1^7 BIT7;

signed char ValueX = 0x00;
.
.
void ReadValue(void);
void main()
{
P1 = 0xFF; //port set high to activate as input
.
.
}

void ReadValue(void) interrupt 0 using 0
{
 .
 .
 .
 ValueX = ValueX | BIT0;
 ValueX = (ValueX <<1) | BIT1;
 ValueX = (ValueX <<1) | BIT2;
 ValueX = (ValueX <<1) | BIT3;
 ValueX = (ValueX <<1) | BIT4;
 ValueX = (ValueX <<1) | BIT5;
 ValueX = (ValueX <<1) | BIT6;
 ValueX = (ValueX <<1) | BIT7;
}
}
i'm sure tat my setting for this ISR works because i had other function inside this ISR that works. But the ValueX doesn't seems to change. It always maintain the value FF. Any help, please.. Thanks

0