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; } }
thanks for the tips. But the condition doesn't change when i change the using 0 to using 1. I still get FF. I think i found the problem. But i can't seems to fix it. Because when i try to send something to SBUF when i activate the external interrupt ISR, the output would be FF no matter what. But when i disable the external interrupt. i could send what ever data i want. for example, when the external interrupt is activated. when i write SBUF = 0x12; it will just show FF. But when i disable the external interrupt. it'll show the correct value(12). why is this so? Any advice is appreciated? Thanks i advance