PDA

View Full Version : disabling the master clear bit MCLR OR MCLRE or using gpio.3 or pin4 or RA3



ofuzzy1
- 23rd February 2011, 04:44
see:
http://www.picbasic.co.uk/forum/content.php?r=157-Presetting-Configuration-Fuses-%28PIC-Defines%29-into-your-Program


disabling the master clear bit MCLR OR MCLRE or using gpio.3 or pin4 or RA3
see below the ?? for how I did this.

??????????????????????????

Is there a better way to do this than changing the .INC file for each chip??
Perspiring minds want to know :)

doing this:
@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF

gets this error
[error 118] ... overwriting previous address 2007h
??????????????????????????

Want to use pin4?
It will only be an INPUT.

' WHEN PROGRAMMING PROGRAM $2007.5 TO LOW THIS WILL ENABLE GPIO.3 / RA3 AS AN INPUT
'
' Set the 2007 Register BIT FIVE [5] to ZERO [0] *****************
----> I currently do this just before programming in the programmer configuration menu.
'
'OR
' change the config file
' OR IN THE C:\PBP\chip.INC
' i.e. C:\PBP\12F683.INC

change this line to:
device pic12F683, intrc_osc_noclkout, wdt_on, mclr_off, protect_off

and this line to:
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF



;************************************************* ***************
;* 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_off, protect_off
; 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_OFF & _CP_OFF
; __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF

NOLIST
endif
LIST

mackrackit
- 23rd February 2011, 08:29
http://www.picbasic.co.uk/forum/showthread.php?t=543

ofuzzy1
- 24th February 2011, 01:35
Thanks Mackrackit -- that was the thread I pointed to at the top.

After reading the thread yet again, : ) At a more reasonable time of day.
Specifically folks want to see post#15.
-- It says to just remove all of the config [ $2007] define code. SO the compiler won't be confused.
-- And put the config info in your program, Just DON'T FORGET TO DO IT FOR EVERY PROGRAM.

Or you can change it to what you normally want and be done with it like I suggested. ;)


Newbie error # 1,289 [Me, me, me]
Of course this thread should also be called 'it won't run and I don't have a clue why'
-- Pin4 is the master clear and is active low, so pull it high and your uC will start to work. Maybe, like hopefully :)

Pull high means use a resistor 1k-470k.