GP3 Funtion on PIC10f202


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2007
    Posts
    15

    Default GP3 Funtion on PIC10f202

    Hi all,
    I am having problems getting GP3 to function as input only in a PIC10f202. Just for testing purposes I am trying to very simply blink and LED once per second on GP0 and throw in an extra pulse (pulse twice per second) when GP3 reads a low on input.

    Here is my code:
    Code:
    trisio.3 = 0
    loop:
    
    high gpio.0
    pause 100
    low gpio.0
    pause 500
    
    if gpio.3 = 0 then
    	high gpio.0
    	pause 100
    	low gpio.0
    endif
    
    pause 500
    
    goto loop
    It is currently pulsing twice per second, and the chip ceases to work when I make GP3 low by pulling it down to ground.

    I am using MPLAB IDE v7.11

    Are there any obvious settings I have missed?
    Last edited by kessral; - 5th March 2009 at 21:46.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    In the config settings turn MCLR or MCLRE, which ever that chip has to OFF.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by kessral;.

    I am using MPLAB IDE v7.11

    Are there any obvious settings I have missed?
    Hi,

    Yesss ... May be update to MPLAB v8.15 !!! ( CAUTION !!! NOT 8.20 - see Melab's site )

    Alain
    Last edited by Acetronics2; - 6th March 2009 at 12:28.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Jan 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    In the config settings turn MCLR or MCLRE, which ever that chip has to OFF.
    In Configuration Bits "Master Clear Enable" is set to "Function as GP3" already, sorry forgot to mention that

    Attempting Upgrade to MPLAB IDE v8.15 now

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Thumbs down Boooooooo ....

    Hi, Kessral

    The surprising thing is you have configured GPIO.3 as an output ( trisio.3 = 0 ), and you intend to read it's state ...

    Moreover, What is ... very annoying is you directly tie an output to ground or VCC ...

    Not so good, yeah ...

    hope you didn't fry it ...

    always use a series resistor ( 1k ) whan you tie a pin to supply rails ...

    Alain

    PS : at the next one like this one, your surname will turn into " Casserole" ... lol.
    Last edited by Acetronics2; - 6th March 2009 at 15:06.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Jan 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    I upgraded to v8.15 and same problem still exists.

    on the PIC10f series GP3 is input or MCLR only and can never be an output. Default setting for GP3 on TRISIO would be 1, which is MCLR so I would assume that setting it to 0 would make it the only other setting it supports (Input only) maybe I am wrong, but I only placed that in the code after trying other methods.

    I do use a resistor (at least 1k but usually much more) to pull GP3 to ground to send in a low, but at that point the chip just draws current as if in normal operation but all output functions cease (as in the LED no longer blinks and no outputs from GP0 exist)

    This is telling me that GP3 is never actually getting set to input only but is staying as MCLR.. I have tried in the past to no avail, I am basically starting fresh with it now and hoping for help lol

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kessral View Post
    In Configuration Bits "Master Clear Enable" is set to "Function as GP3" already, sorry forgot to mention that
    )
    Not sure where you are setting the config? You have some program that is doing it for you?
    You will need to modify the *.inc file in the PBP directory to set the configs correctly.
    This thread may help explain it. It talks about setting the configs in code space and what to do to make it happen.

    http://www.picbasic.co.uk/forum/showthread.php?t=543

    And like Alan pointed out. TRIS for this application and pin should be 1.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Jan 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Oh thank you! Don't know how I missed all this before but after some headache and commenting out 2 lines in the .INC file it works great!

Similar Threads

  1. problem with variable on PIC10f202
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th October 2009, 17:29
  2. PIC10F202 Variable trouble
    By George in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 13th October 2006, 02:14
  3. using gp3 12f629
    By grounded in forum Schematics
    Replies: 4
    Last Post: - 23rd August 2005, 21:15
  4. Problem with Picbasic Pro and PIC10F202, PIC10F206
    By mikaljan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th May 2005, 21:02

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