Using MCLR pin at Input


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2017
    Posts
    6

    Unhappy Using MCLR pin at Input

    I am using a 12F683 and having no luck in disabling the MCLR pin (pin 4 bit 3) so that I can use it as an input.

    In the PicBasic program, I put ANSEL = 0 to set all the pins to digital and CMCON0 = 7 to turn off the analog comparators.

    In the hardware, I attached a 1K ohm pull-up resistor to pin 4, since I read that as an input, the internal pull-up is disabled.

    In the meProg, configuration sections, I set Oscillator to INTOSCIO and th MCLR Pin Function to Input Pin

    In the meProg, Option section, I checked both Update Configuration from File and Reread File Before Programming.

    And yet, the MLCR pin 4 (bit 3) remains a Reset and not an Input.

    What am I doing wrong or not doing to disable the MCLR function?

    Thanks,

    -Jake

    p.s. I also tried to program other 12F683 chips just in case the one I was using was bad, but they all worked the same way.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Using MCLR pin at Input

    Hi,
    To me it looks like you're doing everything right though neither ANSEL nor CMCON should have any effect on GP3 operation.
    However, I don't know the details on how meProg works. Is it possible that what it's actually programming into the chip is STILL what the code says - the default config for the 12F683 is MCLR enabled?

    I guess you can always try that by changing the oscillator setting in meProg and program the chip, if it STILL runs then there's something going on with the CONFIG bits not being programmed to the settings showed in meProg.

    I'm sorry for not having a definitive answer.

    /Henrik.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Using MCLR pin at Input

    I have this in my program (PBP2.60C) and am using GP3 as an input and it works fine.

    @ DEVICE PIC12F683, intrc_osc_noclkout, wdt_on, mclr_off, protect_off , bod_on

    INCLUDE "ALLDIGITAL.pbp"

    The ALLDIGITAL.pbp just makes sure I have everything set as digital.


    The problem is that the PBP assembler uses mclr and mpasm uses MCLRE , see the .inc file

    Code:
    ;****************************************************************
    ;*  12F683.INC                                                  *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2005 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 08/31/05                                        *
    ;*  Version   : 2.46a                                           *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            include 'M12F683.INC'	; PM header
            device  pic12F683, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
            XALL
            NOLIST
        else
            LIST
            LIST p = 12F683, r = dec, w = -302
            INCLUDE "P12F683.INC"	; MPASM  Header
            __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
            NOLIST
        endif
            LIST

  4. #4
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: Using MCLR pin at Input

    "device pic12F683, intrc_osc_noclkout, wdt_on, mclr_on, protect_off"
    "__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF"

    I believe to use the MCLRE pin as a digital input these 2 lines must read "mclr_off" and "_MCLRE_OFF"

    Mike

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: Using MCLR pin at Input

    Quote Originally Posted by mpgmike View Post
    "device pic12F683, intrc_osc_noclkout, wdt_on, mclr_on, protect_off"
    "__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF"

    I believe to use the MCLRE pin as a digital input these 2 lines must read "mclr_off" and "_MCLRE_OFF"

    Mike
    But ONLY if you always want it OFF - and then have to remember to change it in the program, when you want it on.

    The inc file is for general use, and idealy should be left unchanged, - you use the config statements in your program to over ride, as per the statement at top of post 3

    @ DEVICE PIC12F683, intrc_osc_noclkout, wdt_on, mclr_off, protect_off , bod_on

  6. #6
    Join Date
    Jul 2017
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Using MCLR pin at Input

    I found out what to do. I need to reset the configuration file by inserting this code into beginning of the program

    #config
    __config _mclre_off
    #endconfig

    The pin 4 (bit 3) will now be an INPUT with an internal pull-up resistor.

    NOTE: The underline before the config is a double underline __ and not a single underline_

    There is a space after the config and before the _mclre


    Thank you, Henrik, for your response.

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: Using MCLR pin at Input

    #config
    __config _mclre_off
    #endconfig
    can be a bad move , all "unmentioned" config fuse settings will revert to default settings when the chip is erased


    that means your config becomes possibly not whats really intended

    #CONFIG
    __config _EXTRC & _WDT_ON & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOD_ON & _IESO_ON & _FCMEN_ON
    #ENDCONFIG


    imho its best to set the lot the way you intend
    Warning I'm not a teacher

  8. #8
    Join Date
    Jul 2017
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Using MCLR pin at Input

    I want to sincerely thank all of the people who responded with advice and suggestions.

    I not only got the initial problem solved, but I learned some things that I probably would not have figured out on my own that will save me from more problems in the future.

    Thanks,

    -Jake

  9. #9
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Using MCLR pin at Input

    That's great news Jake!
    Please stick around, tell us about your project, participate in the discussions and ask questions (preferrably ones that haven't been answered 100 times already), it's gotten very quiet here lately and we could use some new blood!

    /Henrik.

  10. #10
    Join Date
    Jul 2017
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Using MCLR pin at Input

    I don't know about new blood or even new problems, but I have lots of old versions of both that I will be grateful to share.

    Thanks,

    -Jake

Similar Threads

  1. MCLR Pin
    By Aussie Barry in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th July 2013, 09:58
  2. ICSP with MCLR as input
    By Luckyborg in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th June 2013, 17:40
  3. Q: using MCLR for Input on 12F683
    By picster in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 31st January 2009, 16:25
  4. MCLR line input only
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th April 2008, 00:14
  5. Mclr As Input Pin?
    By omid_juve in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th December 2007, 07:33

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts