On pic power up, the 12C5XX series starts with the program counter at location 1FFh for the 508 and 3FFh for the 509. Whatever instruction is located there is loaded and executed. The osc cal value is either a 6 bit value in the A series (i.e. 12C509A) or a 4 bit number in the non-A series (i.e. 12C509).
The instruction that sits in the 01FF or 03FF location is a MOVLW with the osc cal value. If you dump the memory of a fresh 12C509A for example it will be blank except for location 03FFh which contains in this case 0C9Ch. The MOVLW instruction is 0000 1100 kkkk kkkk. In hex it is 0C kkkk kkkk. The k bits are the osc cal value, in this case 1001 1100. If you look at the osc cal reg you will see that in the A series it contains 6 bits at location 0005h in positions 7-2. That is why the trailing two zeros are there in the binary word. In the non-A part the last nibble is always zero.
So the first thing the processor does on reset is go to 03FF and load 9C into W. The counter increments by one, rolls over to 0000h and executes the next instruction it finds. If you need to use the internal oscillator, then the first thing to do is execute a MOVWF OSCAL and copy W to location 0005h. If you don't need the oscal, then it is overwritten with the first use of W.
To reprogram it back into a JW, in assembly put
org 03FF MOVLW 9C
in CCS use
|file: /Techref/microchip/12c5oscal.htm, 1KB, , updated: 2007/1/18 19:44, local time: 2019/8/18 21:49,
|©2019 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://piclist.com/techref/microchip/12c5oscal.htm"> microchip 12c5oscal</A>
|Did you find what you needed?|
PICList 2019 contributors:
o List host: MIT, Site host massmind.org, Top posters @20190818 RussellMc, David Van Horn, AB Pearce - UKRI STFC, Dwayne Reid, Bob Blick, Jason White, David C Brown, James Cameron, Allen Mulvey, Jim,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to piclist.com!