PDA

View Full Version : 16f688 and MCLR (ra3) as input



kitcat
- 1st March 2005, 17:42
Ok so I know that I have to set RA3 as an input and disable the MCLR function. I see that it also has a weak pull up which can be disabled. How can I set RA3 as an input, i.e. disable the MCLR and weak pull up. I have tried looking everywherre. Can I do it in code?

Thanks

Matt

mister_e
- 1st March 2005, 17:54
everything will be done with config fuses. See the end of your .Inc files in the MPLAb directory

it looks like this



;================================================= =========================
;
; Configuration Bits
;
;================================================= =========================

_FCMEN_ON EQU H'3FFF'
_FCMEN_OFF EQU H'37FF'
_IESO_ON EQU H'3FFF'
_IESO_OFF EQU H'3BFF'
_BOD_ON EQU H'3FFF'
_BOD_NSLEEP EQU H'3EFF'
_BOD_SBODEN EQU H'3DFF'
_BOD_OFF EQU H'3CFF'
_CPD_ON EQU H'3F7F'
_CPD_OFF EQU H'3FFF'
_CP_ON EQU H'3FBF'
_CP_OFF EQU H'3FFF'
_MCLRE_ON EQU H'3FFF'
_MCLRE_OFF EQU H'3FDF'
_PWRTE_OFF EQU H'3FFF'
_PWRTE_ON EQU H'3FEF'
_WDT_ON EQU H'3FFF'
_WDT_OFF EQU H'3FF7'
_LP_OSC EQU H'3FF8'
_XT_OSC EQU H'3FF9'
_HS_OSC EQU H'3FFA'
_EC_OSC EQU H'3FFB'
_INTRC_OSC_NOCLKOUT EQU H'3FFC'
_INTRC_OSC_CLKOUT EQU H'3FFD'
_EXTRC_OSC_NOCLKOUT EQU H'3FFE'
_EXTRC_OSC_CLKOUT EQU H'3FFF'
_INTOSCIO EQU H'3FFC'
_INTOSC EQU H'3FFD'
_EXTRCIO EQU H'3FFE'
_EXTRC EQU H'3FFF'


you'll have to write a line to define your config fuse. Choose _MCLRE_OFF

How to do that? click here (http://www.picbasic.co.uk/forum/showthread.php?t=543)

Probably you'll have this message 'overwriting previous content....'
use notepad, open 16F688.inc in your PBP directory. looks like this


;************************************************* ***************
;* 16F688.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2003 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 11/06/03 *
;* Version : 2.45 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
include 'M16F688.INC' ; PM header
device pic16F688, intrc_osc, wdt_on, mclr_on, protect_off
XALL
NOLIST
else
LIST
LIST p = 16F688, r = dec, w = -302
INCLUDE "P16F688.INC" ; MPASM Header
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
NOLIST
endif
LIST


cooment the 'device' or 'config' line and you're i business.

OR modify within this file and forget the define in your code... i

peterdeco1
- 1st March 2005, 18:15
Hello Matt. I just did the exact thing with a PIC16F819. I'm sure it works for them all. At the top of your code put:

@ DEVICE MCLR_OFF

Or you can manually turn it off on the programming software. Hope this helps.