I have been trying to figure out how the code that Microchip uses in their template for PIC 10F206 works to set the OSCCAL value into its' register... The template has:
ORG 0x1FF ; processor reset vector
; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.
ORG 0x000 ; coding begins here
movwf OSCCAL ; update register with factory cal value
I am familiar with the use of ORG or CODE to branch around an interrupt vector by placing vectors to the main program and interrupt routine, but in the case of OSCCAL, what is needed is to execute the code at memory location at 1FF.. which in the chip I am using at present is CFA.. which is a movlw FA. If the code was:
movlw 0xFA
OSCCAL
I can see how this would work.. but how do the two ORG statements in the template accomplish this?