Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

internal clock PIC 16F88

Status
Not open for further replies.

EXODUS

New Member
Ok Im trying to set the internal clock on the PIC 16f88 the data sheet says to set the config reg bit's 4, 1, and 0. the code i want to use is 100 which sets pins RA6 and RA7 to I/O. what i dont understand is do i set the last three bits of the config reg to 100 or do i set bit 4 to 1, and bit's 1-0 to 0 :confused:
 
hi exodus,

Look at page 130 of the 16F88 data sheet for the configuration word.

You need this at the head of your program

__config 0x3D1A, follow the datasheet,

change bits 1,0 for the osc, don't change any others until you know what you are doing

Come back if you dont follow it.

EricG
Also look thru Nigel's tutorials.
 
Last edited:
I really don't know why people work out what the config should be. Microchip supply a template file that you should use. You'll find it in C:\Program Files\Microchip\MPASM Suite\Template\Code\f88temp.asm

In the template file you will find this config line,
__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_IO

It's self explanatory. If you want LVP then change LVP_OFF to LVP_ON.

As it happens, it's already setup for internal oscillator with the pins as IO.

If you want a different osc setting then change INTRC_OSC to one of the following, _EXTRC_CLKOUT, _EXTRC_IO, _INTRC_CLKOUT, _EXTCLK, _HS_OSC, _XT_OSC, _LP_OSC

If you want a complete list of config values then look in the P16F88.inc file located at C:\Program Files\Microchip\MPASM Suite

HTH

Mike.
 
Nigel Goodwin said:
I don't "work it out", I just select the options I want in WinPicProg and it displays the value!.

OK, I'll rephrase that. I don't understand why people use a calculator when the assembler will work it out for you.

It has the added advantage that if you switch to a different chip the config will still work. It also makes your code much more readable and changeable.

Mike.
 
Isn't that like arguing that movwf 4 is less error prone than movwf PORTB.

Mike.
 
hi mike,

I too use the __CONFIG string as per the template, I find it easier to scan thru tokens, rather than a hex word.

I suggested it to the OP, because he didn't seem do follow what 'blueroomelect' was suggesting. 'What'

Lets hope once he understands the config word he will move onto the template.

Eric
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top