PIC 16F648A Configuration

Status
Not open for further replies.

SwingeyP

Member
Hi.

I have always built my circuits using external oscillators. (4HMz xtal)
I want to try the internal oscillator but im having problems.

Can anyone tell me the correct configuration for a 16f648a please.

I am currently using

Define CONF_WORD = 0x3f50 (Oshon pic basic)

Regards - Paul
 
Hi,

The MPASM Template file config code might help.
Code:
;**********************************************************************

    list      p=16f648A           ; list directive to define processor
    #include <p16F648A.inc>       ; processor specific variable definitions

    errorlevel  -302              ; suppress message 302 from list file

    __CONFIG   _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT 

; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings.
 
Hmm im clearly doing something wrong here.

I have set the configuration using the Oshon simulator as follows:

Brown-out-reset - Enabled
Flash Program Memory Code Protection - OFF
Data EEPROM Memory Code Protection - OFF
Power Up Timer - Enabled
Watchdog Timer - Enabled
RA5/ \MCLR Pin Function Select - Digital Input
Oscillator Selection - INTOSC

This give the configuration word as 3FD4h (Unless you know better)

I have had the code runnig on my board for ages but want to try it without the external 4mhz xtal.

Do I need any electronics on the usual xtal pins?

Regards - Paul
 
Use this __config 0x2118 it will set it to use INTOSC

You have the osc set to this LP oscillator: Low-power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN with this 3FD4h

The data sheet tell you starting at bit 0 you want
0 at bit 0 Oscillator Selection bits
0 at bit 1 Oscillator Selection bits
0 at bit 2 0 = WDT disabled
0 at bit 3 0 = PWRT enabled
1 at bit 4 Oscillator Selection bits
0 at bit 5 0 = RA5/MCLR/VPP pin function is digital Input, MCLR internally tied to VDD
0 at bit 6 0 = BOR Reset disabled a 1 if you need this
0 at bit 7 0 = RB4/PGM is digital I/O, HV on MCLR must be used for programming++
1 at bit 8 1 = Data memory code protection off you sure want this a 1
0 at bit 9 Unimplemented: Read as ‘0’
0 at bit 10 Unimplemented: Read as ‘0’
0 at bit 11 Unimplemented: Read as ‘0’
0 at bit 12 Unimplemented: Read as ‘0’
1 at bit 13 1 = Code protection off
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…