PIC12F683 pin GP3 as output


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1

    Default PIC12F683 pin GP3 as output

    Hello folks,
    before I tried play with picbasic I worked with PICAXE. I have done few projects with PICAXE 08M2 which is a rebranded PIC12F683 with bootloader.
    In PICAXE is one simple cheat which allows to use the pin3 (MCLRE) as output. Pin3 drives an NPN transistor via manipulating weak pullup resistor. In attachment find the schematis which I use wery often. It works fine all the time.
    For example here is a simple led blinking code in PICAXE looks like:
    Code:
    #picaxe 08m2
    do
    pullup $08    ;pullup on GPIO.3 LED ON
    pause 500
    disable          ;disable pullups LED OFF
    pause 500
    loop
    Name:  GPIO3_output.png
Views: 2250
Size:  345.8 KB

    Now the question is how do they made it? I try similar on PIC12F683 in picbasic but no success.
    Try to led blinking code in picbasic like:
    Code:
    ;PIC12F683
    
    TRISIO=0
    ANSEL=0
    OPTION_REG.7=1   ;enable WPU
    
    strt:
    wpu=%00001000      ;enable WPU on GPIO.3
    pause 500
    wpu=%00000000      ;disable WPU on GPIO.3
    pause 500
    goto strt
    end
    OK, I now this is not work. I also now the GPIO.3 WPU is activatable only via
    MCLRE, the GP3 pull-up is enabled when MCLRE is set to"1" in the configuration word register, and disabled when MCLRE is set to"0".

    How It works in PICAXE, thats the question. Does anyone have an idea?

    Louis

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default Re: PIC12F683 pin GP3 as output

    can you post also the fuse configuration?

    Ioannis

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: PIC12F683 pin GP3 as output

    Hello,

    in PICAXE no need to use any config.

    In picbasic I use this:

    Code:
    #CONFIG
    __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
    #ENDCONFIG
    But I also used this:

    Code:
    #CONFIG
    __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _CP_OFF
    #ENDCONFIG

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default Re: PIC12F683 pin GP3 as output

    The weak pullup on GP3 is enabled only when MCLR is enabled.

    You may try also ANSEL to set it to

    DO
    ANSEL=0
    PAUSE 500
    ANSEL.3=1
    PAUSE 500
    LOOP

    This will enable and disable the weak pullup.

    Ioannis

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: PIC12F683 pin GP3 as output

    Quote Originally Posted by Ioannis View Post
    The weak pullup on GP3 is enabled only when MCLR is enabled.

    You may try also ANSEL to set it to

    DO
    ANSEL=0
    PAUSE 500
    ANSEL.3=1
    PAUSE 500
    LOOP

    This will enable and disable the weak pullup.

    Ioannis
    tried, not working. ANSEL.3 is for pin GP4 not for GP3.

  6. #6
    Join Date
    Oct 2011
    Posts
    54


    Did you find this post helpful? Yes | No

    Default Re: PIC12F683 pin GP3 as output

    Try setting GP3 to input as setting to output turns off weak pull-ups

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: PIC12F683 pin GP3 as output

    GP3 is setupable only as input.

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default Re: PIC12F683 pin GP3 as output

    OK, then this would only work if one could change the MCLR bit in config word, address 2007h.

    But this can only be accessed in Programming the chip...

    Interesting one!

    Ioannis

  9. #9
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: PIC12F683 pin GP3 as output

    GP.3 is only configurable as an added input pin when nor being used as the RESET pin. NO output configuration is possible.
    Dave Purola,
    N8NTA
    EN82fn

  10. #10


    Did you find this post helpful? Yes | No

    Default Re: PIC12F683 pin GP3 as output

    yes, if I configure the MCLR bit in config word to "1" then the LED is ON because the transistor is open via internal pull-up. If I configute the MCLR bit to "0" then internal pull-up is disabled and the transistor is closed because the 1M resistor is pull the base to ground.
    That's work, but how to do that in program I don't know. However, it must work somehow, because in PICAXE environment it works.

  11. #11
    Join Date
    May 2013
    Location
    australia
    Posts
    2,389


    Did you find this post helpful? Yes | No

    Default Re: PIC12F683 pin GP3 as output

    how sure are you that a picaxe 8m2 is a 12f683

    this makes me doubtful a 12f683 pegs out at 20mhz
    Attached Images Attached Images  
    Warning I'm not a teacher

Similar Threads

  1. Question on using MCLR pin for interupt. (PIC12F683)
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th February 2009, 02:15
  2. Turn on output pin
    By savnik in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th March 2007, 11:49
  3. Input / output using same pin
    By leonel in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th March 2007, 21:19
  4. using TOCK pin as output?
    By droptail in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th November 2006, 17:15
  5. How to set analog pin to output 5V?
    By james in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th July 2004, 07:24

Members who have read this thread : 3

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