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 18:44, local time: 2018/2/24 00:16,
|©2018 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://techref.massmind.org/techref/microchip/12c5oscal.htm"> microchip 12c5oscal</A>
|Did you find what you needed?|
Welcome to massmind.org!
Welcome to techref.massmind.org!