• AVR Freaks

Hot!Input GP3 not responding when programming the 12F508

Author
Ken Sookhoo
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2015/01/14 18:29:09
  • Location: 0
  • Status: offline
2019/04/26 11:56:42 (permalink)
0

Input GP3 not responding when programming the 12F508

I have used the PICSTART PLUS for several years and had great success in designing numerous projects. Recently I purchased the PicKit4 and switched to using MPLAB X version 5.10. On my first simple test project, using the Microchip 12F508, it worked very well except for the input GP3. I know that this pin is labeled as GP3/ MCLR /Vpp but I am unable to get it to respond as an input GP3. I have tried setting the MCLR in CONFIG both ON and OFF without getting the required response.
1.            When I set the MCLR in CONFIG to OFF, GP3 (pin 4) sees a high even when it is connected to low through a 1K resistor.
2.            When I set the MCLR in CONFIG to ON, GP3 constantly sees a low even though it is connected to a high through a 10K + 1K resistor. Switching it to a low has no effect.
3.            On my test board, I have a pull-up 33K resistor connected between pin 4 and pin 1. I have tried the above with and without this pull-up resistor and it has no effect.
4.            All the other I/Os work fine.
5.            Please advise what settings I am missing or if the 12F508 is no longer compatable
Here is the simple test program I am using:
__CONFIG _OSC_IntRC & _WDT_OFF & _CP_ON & _MCLRE_OFF
    
 
MAIN        CODE    0x000
                    movwf   OSCCAL           ; update register with factory cal value
start           movlw   b'11101000'        ; set GP0,GP1,GP2,GP4 as outputs
                    TRIS    GPIO        
                    movlw   b'11011111'    ;Disable "TOCKl" at pin #5
                    option
;                
Begin         clrf    GPIO                        ;Repeat ON-OFF action   
                    BTFSS   GPIO,3                  
                    goto    Sequence
                    goto    Begin                      
Sequence    BSF     GPIO,0                 
                    call    Pause        
                    BCF        GPIO,0
                    call    Pause                       
                    BSF         GPIO,1
                    call    Pause       
                    BCF        GPIO,1
                    call    Pause                         
                    BSF         GPIO,2                 
                    call    Pause
                    BCF        GPIO,2
                    call    Pause
                    BTFSS   GPIO,5
                    goto    Begin
                    goto    Sequence         
 
#1

5 Replies Related Threads

    PStechPaul
    Super Member
    • Total Posts : 2252
    • Reward points : 0
    • Joined: 2006/06/27 16:11:32
    • Location: Cockeysville, MD, USA
    • Status: online
    Re: Input GP3 not responding when programming the 12F508 2019/04/26 13:19:49 (permalink)
    0
    I don't see any problem with the code, but I wonder why you have _CP_ON. Also, please provide the full project files. Maybe there is something wrong in the "Pause" subroutine?

     
    #2
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Input GP3 not responding when programming the 12F508 2019/04/26 14:51:17 (permalink)
    0
    Ken Sookhoo
    ...
    I have tried setting the MCLR in CONFIG both ON and OFF without getting the required response.

    It is MCLRE, not MCLR that you are setting. It should be "off" to use that pin as an input.
     

    2.            When I set the MCLR in CONFIG to ON, GP3 constantly sees a low even though it is connected to a high through a 10K + 1K resistor. Switching it to a low has no effect.

    That is impossible.
    When MCLRE is ON, your PIC will be held in reset when the MCLR pin is held low. It can't run code.
     
    As Paul requested, please post the ENTIRE program. That snippet is missing bits.
     

    Nearly there...
    #3
    DeutcheN
    Senior Member
    • Total Posts : 105
    • Reward points : 0
    • Joined: 2010/09/01 12:35:40
    • Location: DM43BH
    • Status: offline
    Re: Input GP3 not responding when programming the 12F508 2019/05/22 11:12:10 (permalink)
    0
    Ken:
     Were you able to make it work?
     
    Tried your code with PICKit4 and MPLABX 5.15.  Had to write a pause routine using NOPs since it was not provided.  LEDs turn on and off like a charm.  Setting to Vdd GPIO5 keeps the program in the Sequence loop.  Connecting GPIO5 to GND, pogram jumps out of Sequence loop into Begin loop.  Conecting GPIO3 to GND sends the program  back to the Sequence loop. 
      You may want to check you connections and post your entire code.
    #4
    nigelwright7557
    Super Member
    • Total Posts : 213
    • Reward points : 0
    • Joined: 2006/11/06 08:15:51
    • Location: 0
    • Status: offline
    Re: Input GP3 not responding when programming the 12F508 2019/05/22 13:50:46 (permalink)
    0
    GP3 is an input pin only.
     
    #5
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Input GP3 not responding when programming the 12F508 2019/05/22 15:10:51 (permalink)
    0
    nigelwright7557
    GP3 is an input pin only.

    So? All the OP is trying to do is read it as an input.
     

    Nearly there...
    #6
    Jump to:
    © 2019 APG vNext Commercial Version 4.5