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.

PIC2620/4620 and 2520 datasheets wrong?

Status
Not open for further replies.

Boomslang

Member
Hi All

In OCSTUNE TUN4:TUN0. That is 5 bits, but in the datasheet it shows 6 bits??? It also shows the 6th bit as unimplemented? I dont have a scope to test if it does in fact use 6 bits to change the OSC speed.

Can anyone of you shed some light on it please?
 
When in doubt check the device file,

sfr (key=OSCTUNE addr=0xf9b size=1 access='rw rw u rw rw rw rw rw')
reset (por='00-00000' mclr='0--00000')
bit (names='HF256DIV PLLEN - TUN' width='1 1 1 5')
stimulus (scl=rwb pcfiles=rw regfiles=w)

So, it's 5 bits in total.

You'll find the dev file in C:\Program Files\Microchip\MPLAB IDE\Device

Mike.
 
BTW, if you're trying to use the PLL with the internal oscillator you must set OSCCON to 0x60 or 0x70. Setting it to 0x62 or 0x72 stops the PLL from functioning. This is not mentioned in the DS anywhere and had me pulling my hair out.

Mike.
 
How are you going to adjust your clock? How will you know if it's running slow or fast? Most applications are happy with the 1% accuracy or use a crystal.

Mike.
 
You can tune the clock, you just can't select the internal oscillator in OSCCON (not OSCTUN). You have to select primary oscillator and select internal in the config.

Mike.
 
I am building a chronograph, so the adjustment will be once off when calibrating it. I need around +-5% adjustment.

BTW I have it running at 8MHz X 4xPPL = 32MHz. I know that part is working as I used some code from one of my old projects.
 
Last edited:
The internal oscillator will vary with temperature, Vdd and the colour of the sky. If you're making a chronograph I would add a 32kHz crystal as the timer 1 oscillator. You then have a very accurate timer 1 and up to 32MHz internal frequency.

Edit, change that to a 38k crystal if you want a 100Hz or 1kHz interrupt.

Mike.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top