Hi,
I am having a problem with using port B as inputs. The inputs are inverted. Here is the code.
I have tried the same code on both 871, and 877A with the same results.Code:#config __config _HS_OSC & _WDT_ON & _PWRTE_ON & _BOREN_ON & _CP_ON #ENDCONFIG define OSC 20 TRISC = 0 TRISD = 0 TRISB = 255 led1 var portd.7 led2 var portd.6 led3 var portd.5 led4 var portd.4 led5 var portd.5 led6 var portc.7 switch var portb.3 high led5 high led6 start: if switch = 0 then high led1 high led2 high led3 high led4 pause 3000 endif portd = 0 while switch = 0 wend goto start end
If I move the switch to any other port B pin then the program works as expected, the LEDs light for 3 seconds, and will only light again after releasing, and pressing the switch again.
With the switch on port B3 pressing the switch turns on the LEDs as expected, but if I let go of the switch all outputs switch off instantly, not after 3 seconds. Then pressing the switch again will light up all of the outputs again, the first 4 for 3 seconds if I keep the switch pressed. Letting the switch go after that will turn off all outputs.
It seems that taking B3 low is ok but then if it goes high again then the outputs all go off, and the program will not function.
Anyone have any ideas please?
Regards
Bob.




Bookmarks