Please help configure 16F676


Closed Thread
Results 1 to 2 of 2
  1. #1

    Default Please help configure 16F676

    I'm using a 16F676. The program was working fine till I changed the hardware to use PORTA.3 as a digital input to recognize a pushbutton. Now as soon as the button is pressed the whole thing locks up and I have to turn the power off to get it to reset.

    I know I need to turn MCLRE off. I think I did that, but obviously I did something wrong or I've left something out. Please help me figure out how to use PORTA.3 as a digital input.

    FYI, PORTA.1/AN1 and PORTA.2/AN2 are connected to potentiometers and being used as analog inputs.

    Code:
    #config 
        __CONFIG _CP_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT& _MCLRE_OFF
    #endconfig
    
    
    ADCON1 = %00000000
    ANSEL = %00000110
    CMCON = %00000111      
    
    
    TRISA = %00001111
    TRISC = %00000000
    
    
    ' Set TMR0 to interrupt every 16.384 milliseconds
       OPTION_REG = %10000101        ' Set TMR0 configuration and enable PORTB pullups
       INTCON = %10100000           ' Enable TMR0 interrupts
       On Interrupt Goto tickint
        
        '                      
        '    Hardware connection
        '    ===================
     
        CS          VAR PORTA.5                                                                     ' digital potentiometer SPI connection
        SCK         VAR PORTC.2                                                                    ' digital potentiometer SPI connection
        SDI          VAR PORTC.1                                                                    ' digital potentiometer SPI connection
        tempobutton var PORTA.0                                                                  ' push button 1
        tempoLED var PORTC.0                                                                      ' push button 1 status LED
        trailsbutton var PORTA.3                                                                    ' push button 2
        trailsLED var PORTC.4                                                                       ' push button 2 status LED
        mosA var PORTC.5                                                                           ' MOSFET switch A
        mosB var PORTA.4                                                                           ' MOSFET switch B
        mosC var PORTC.3                                                                           ' MSOFET switch C

  2. #2
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Please help configure 16F676

    Just guessing here but the spacing after noclockout might not recognize the ampersand and therefore the mclre_off config. Could it be that easy?

Similar Threads

  1. Configure Debug @ runtime?
    By dhouston in forum Serial
    Replies: 5
    Last Post: - 11th November 2011, 21:04
  2. how to configure external oscillator
    By itsssyam in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th March 2011, 12:15
  3. CONFIGURE & OSCCON & meProg configure
    By SUNFLOWER in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th February 2011, 21:25
  4. How do I configure the PIC16F737?
    By LinkMTech in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th November 2007, 23:05
  5. How to configure the clock??!!
    By sergio.elias in forum Serial
    Replies: 3
    Last Post: - 21st June 2006, 04:48

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