12F683 GPIO.3 MCLR pin - unusual response


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    78

    Default 12F683 GPIO.3 MCLR pin - unusual response

    Today I setup a 12F683 hoping to read pins 2,3, and 4 masked out as a 3-bit word.
    I set the chip's bit config to turn off MCLR on pin 4 gpio.3

    Pin 4 when not used as a MCLR reset functions as input only.
    So I set pins 2, and 3 also as inputs

    Then I put 10K resistors on each - pulling them down to ground.
    I then set the code to read GPIO and mask out all the other pins.
    Then right-shifted the results to derive the lowest 3 bits

    Pulling any combination of these 3 pins high should result in values ranging 0-7.

    Pins 2, and 3 acted as expected.
    However, the MCLR pin was acting flaky.
    Even with the pull down resistor on it - it was flipping back and forth between a high and low reading.
    I've never seen this before.

    I dug through the datasheet to see if I could find something peculiar about pin-4 MCLR with no success.

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


    Did you find this post helpful? Yes | No

    Default Re: 12F683 GPIO.3 MCLR pin - unusual response

    GP3 does not have any other function except MCLR if set to.

    So the erratic behavior may be related to the software. Show the code please.

    Ioannis

  3. #3
    Join Date
    Jan 2007
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: 12F683 GPIO.3 MCLR pin - unusual response

    Quote Originally Posted by Ioannis View Post
    GP3 does not have any other function except MCLR if set to.

    So the erratic behavior may be related to the software. Show the code please.

    Ioannis
    Thank you Ioannis!
    A funny thing happened to me on the way to re-turning to this....... This morning it worked as I would have expected.
    And I couldn't reproduce the previous behavior.
    But I do thank you for prompting me.
    I would have otherwise thought wrong about the chip.

    Here is the code and use case:
    I have a re-built Nintendo game controller.
    It originally had a 4021 shift-register which died.
    So I removed that part and replaced it with 6 germanium diodes - which convert 6 possible button presses to a 3-bit binary word (0-7)
    For my test bench I have a pic-based LCD display I use as a Serial Monitor



    ' Name : 12F683_DiodeSwitchControl_SerialLCD-DisableMCLR.pbp
    ' Compiler : PBP3
    ' Target PIC : PIC12F683
    ' Oscillator : 4MHz internal
    ' Description : Diode Switch matrix 6 switches to 3bit binary
    ' Note: Disable MCLR_reset function PIN-4 to use this pin as input
    ' Send Output to Serial LCD

    '1 VDD
    '2 GP5/T1CKI/OSC1/CLKIN
    '3 GP4/AN3/T1G/OSC2/CLKOUT
    '4 GP3/MCLR/VPP
    '5 GP2/AN2/T0CKI/INT/COUT/CCP1
    '6 GP1/AN1/CIN-/VREF/ICSPCLK
    '7 GP0/AN0/CIN+/ICSPDAT/ULPWU
    '8 VSS

    #CONFIG
    __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF
    #ENDCONFIG

    Include "modedefs.bas" ' Mode definitions for Serout

    ' Alias pins
    LCD Con 0 ' Alias GPIO.0 to Serial LCD

    ' INIT global variables
    SwitchNum Var Word

    ' Function Registers Setup
    ANSEL = 0 ' Disable analog A/D functions
    CMCON0 = 7 ' Analog comparators off
    TRISIO = %00001110 ' GPIO.1,2,3 inputs - others outputs - and GP0 feeds LCD
    GPIO = 0 ' Flush GPIO

    ' MAIN PROGRAM
    mainloop:
    Serout LCD, T9600, ["?c0"] ' Turn off flashing cursor
    pause 50
    Serout LCD, T9600, ["?f"] ' Clear screen start at leftmost cell
    pause 50
    Serout LCD, T9600, ["READY"]
    pause 1000

    DO WHILE (1)
    Serout LCD, T9600, ["?f"] ' Clear screen start at leftmost cell
    SwitchNum = GPIO & %00001110 'Capture GPIO(1,2,3) binary value
    SwitchNum = SwitchNum >> 1


    Serout LCD, T9600, [#SwitchNum]
    Pause 50

    LOOP
    Goto mainloop ' Do it forever

    End

Similar Threads

  1. SEROUT 12F683 and GPIO.5
    By AvionicsMaster1 in forum General
    Replies: 6
    Last Post: - 4th April 2013, 23:58
  2. 12F683: I change GPIO.5 but GPIO.0 also changes...why?
    By chicowoodhill in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th December 2012, 18:09
  3. Replies: 2
    Last Post: - 24th February 2011, 02:35
  4. 12F683 GPIO.3 problem
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 30th October 2009, 09:43
  5. Configuring the GPIO.3/MCLR Pin
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th July 2004, 18:00

Members who have read this thread : 2

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