I've been out of the loop for quite some time but I have a need for a small project. I'm using a 16F688 and trying to use PORTA to read digital values (button presses). I've read the data sheet and tried adjusting the code but nothing seems to work. I've stripped the code down to the bare minimum, even removing all of the analog stuff (I think), but it's still not working:
It's blinking the LED even though 5VDC is on A.1. The same goes for A.5, A.4 and A.0. When I press a button on A.3, the MCU resets as if the MCLR is enabled but I set MCLR to off. There is probably something simple I'm overlooking. Can anyone help me?Code:@ DEVICE PIC16F688, INTRC_OSC_NOCLKOUT,WDT_ON, PWRT_OFF, MCLR_OFF, BOD_ON,PROTECT_OFF TRISA = 111111 TRISC = 111111 ANSEL = 000000 CMCON0 = 000000 ADCON0 = 000000 DECREASEBUT VAR PORTA.3 INCREASEBUT VAR PORTA.1 ENTERBUT VAR PORTA.4 MODEBUT VAR PORTA.0 LED VAR PORTC.1 Start: IF INCREASEBUT=0 THEN GOTO INCREASE GOTO START INCREASE: HIGH LED PAUSE 500 LOW LED PAUSE 500 GOTO START




Bookmarks