Weak Pull-up on 12F683


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Location
    UK-Midlands
    Posts
    84

    Default Weak Pull-up on 12F683

    Just started to us the 12F683 and I have searched the forum and the datasheet but can't get the pull-ups working on the input of the attached program!

    If I ground the input (GP5) the program behaves as expected rapid LED flashing. If I connect the input to 5v I again get the LED to flash with the longer flash. But disconnecting the input (floating) from either state does not change the flash sequence.

    I suspect (hope!) it is something simple but can’t see it!
    ************************************************** *
    @ DEVICE pic12F683, INTRC_OSC_NOCLKOUT
    @ DEVICE pic12F683, WDT_OFF
    @ DEVICE pic12F683, PWRT_ON
    @ DEVICE pic12F683, BOD_ON
    @ DEVICE pic12F683, MCLR_OFF
    @ DEVICE pic12F683, IESO_OFF
    @ DEVICE pic12F683, FCMEN_OFF
    @ DEVICE pic12F683, CPD_OFF
    @ DEVICE pic12F683, PROTECT_OFF

    OSCCON = $60 'sets the oscillator speed
    DEFINE OSC 4 'Oscillator speed in MHz
    CMCON0 = 7 ' Comparators off
    ANSEL=0
    TRISIO=%01011
    VRCON=0
    WPU=%00110111 ' Pull-ups on
    OPTION_REG.7=0 ' Enable internal pull-ups

    LED VAR GPIO.2
    LEVEL VAR GPIO.5

    st:
    LED =1
    PAUSE 200
    LED =0
    PAUSE 200
    IF LEVEL=1 THEN ST
    LED =1
    PAUSE 1000
    LED =0
    PAUSE 200
    GOTO st
    END
    ***************************************

    Thanks,
    Bob

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


    Did you find this post helpful? Yes | No

    Default

    Using a partial binary number like TRISIO=%01011 does not set GPIO.5 up as
    an input.

    The remaining upper 3-bits are by default 0's, so you're forcing GPIO.5 to be
    an output.

    Output port latches power-up with an undetermined value, so you don't really
    know if you're shorting the pin with a high or low, but you definitely are.

    Even pins configured as outputs can be read, so while you're grounding or
    taking the pin to Vcc, it's still going to read the pin & react accordingly.

    Make the pin an input. Should clear up whatever problems you're having.
    Regards,

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

  3. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    It does not appear you have set GP5 as an input.

    Try:

    TRISIO=%101011

    Good Luck,

    Paul Borgmeier
    Salt Lake City, Utah
    USA

    edit - looks like I hit return 3 minutes after Bruce did (at least we match) pb
    Last edited by paul borgmeier; - 10th April 2006 at 23:40.

  4. #4
    Join Date
    Mar 2004
    Location
    UK-Midlands
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Many thanks everyone. It was the TRISIO data. As you identified I didn't enable GPIO.5 as an input!
    It was late and too much coffee. It didn't help the software acting as if the port was an input...

    Now working as expected.

    Thanks,
    BobP

Similar Threads

  1. Pull Up enabled and PWM question
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th September 2009, 08:21
  2. Weak pull-ups, WPU, and 12F683
    By RussMartin in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd February 2009, 22:14
  3. Weak pull Up 12F629
    By Lionheart in forum General
    Replies: 1
    Last Post: - 9th December 2008, 21:07
  4. 12F683 internal pull up
    By hvacrtech in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th July 2008, 02:35
  5. 16f684 Porta.2 Instability
    By JDM160 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 5th November 2006, 02:38

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