Problem with 16F688 and using PORTA as digital inputs - I'm pulling my hair out!


Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425

    Default Problem with 16F688 and using PORTA as digital inputs - I'm pulling my hair out!

    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:

    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
    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?
    Last edited by Christopher4187; - 14th June 2012 at 15:39.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts