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.
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
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
Re: Using MCLR pin at Input
Quote:
Originally Posted by
mpgmike
"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
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.
Re: Using MCLR pin at Input
Quote:
#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
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 :)
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.
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