12F629 Wakes only once


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    I believe you may have a mismatch condition on the ports.

    Try changing the following:
    Code:
    INTCON.1 = 0
    HIGH GPIO.1
    PAUSE 100
    LOW GPIO.1
    to:
    Code:
    temp = GPIO.2'read to dummy variable to clear mismatch condition of port (see s3.2.2 of datasheet)
    INTCON.1 = 0
    HIGH GPIO.1
    PAUSE 100
    LOW GPIO.1

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Hi Languer- Thanks for trying, but no cigar! Adding the line you suggested resulted in a syntax error, so I added INTCON.0 = 0 instead (To clear GPIF). I get the same result. Strange.

  3. #3
    Join Date
    Aug 2008
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Please put a pull down resistor 10K to GND from GPIO.2

  4. #4


    Did you find this post helpful? Yes | No

    Default

    I currently have a 3k resistor there.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Place GOTO Main after your last PAUSE 1000. You should see a quick 100mS pulse on the
    LED after the 1st wake-up, and a 2 second LED on time after the 2nd wake-up.

    Using the internal oscillator you might also want to include DEFINE OSCCAL_1K 1 to make
    sure it's calibrated.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Sorry Bruce, I made both changes, and the results are the same. I get one long pulse on the LED, LED goes off until button is pressed, then short pulse and then off again. Next press of button does nothing.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Strange. This works precisely as expected. No matter how many times I press/release the
    switch.
    Code:
    @ DEVICE MCLR_OFF, INTRC_OSC_NOCLKOUT, WDT_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF
    DEFINE OSCCAL_1K 1
    
    CMCON = 7
    TRISIO = %001100
    OPTION_REG = %01000000
    GPIO = 0
    T1CON = 0
    
    'GPIO.0 =
    'GPIO.1 = LED HIGH OUT
    'GPIO.2 = SWITCH HIGH INPUT
    'GPIO.3 = MCLR TIED HIGH
    'GPIO.4 =
    'GPIO.5 =
    
    Main:
        HIGH GPIO.1 
        PAUSE 1000
        LOW GPIO.1 
        
        INTCON.1 = 0
        INTCON.4 = 1
        FLAGS = 0
        @ SLEEP
        @ NOP
        
        INTCON.1 = 0
        HIGH GPIO.1
        PAUSE 100
        LOW GPIO.1
        
        INTCON.1 = 0
        INTCON.4 = 1
        FLAGS = 0
        @ SLEEP
        @ NOP
        HIGH GPIO.1
        PAUSE 1000
        GOTO Main
        
        END
    10K pull-down to ground on GPIO.2 with switch pulling it to Vcc on press.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. 12F629 LDR - Light Dependant Resistor
    By Dennis in forum Schematics
    Replies: 15
    Last Post: - 18th February 2010, 22:33
  2. Basic help for 12F629
    By Gene Choin in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd September 2009, 04:06
  3. sleep on 12f629
    By sirvo in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th February 2007, 14:08
  4. Servo control with 12F629
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd June 2005, 23:34
  5. 12F629 I2C problems
    By AIW128ProGuy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th November 2004, 23:41

Members who have read this thread : 0

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