We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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; } }
Possibly this is your problem:
void ReadBits (void) interrupt 0 using 0
void ReadBits (void) interrupt 0 using 1