Hey Folks,
So basically, I'm following Gooligum's Tutorial series on PIC , a fine work I might add, and working with the PIC 12F509 emulated through Real Pic Simulator. I'm confused about the whole OSCCAL thing.
Here's my code:
As I understand from reading the tutorial (baseline, lesson-01), Microchip inserts a default calibration value at 0x3FF, wrapped in a 'movlw' instruction.
In my code,
tells the processor to execute the instruction ("movlw k") situated at 0x3FF, which copies the OSCCAL to W. Seeing as 0x3FF is the last memory address, Gooligum says that the "pointer" wraps back around to the first memory address (0x000h).
For some reason, in my simulation software (Real Pic Simulator) I get an "Out of Code" error generated from this line. I don't understand why this is happening. Even if (in simulation) the 0x3FF memory address is empty, the program should still wrap around to 0x000h and proceed, no?
I'm a total newbie so I ask that anyone kind enough to respond please consider that. I don't know much of the tech-jargon.
Help!
So basically, I'm following Gooligum's Tutorial series on PIC , a fine work I might add, and working with the PIC 12F509 emulated through Real Pic Simulator. I'm confused about the whole OSCCAL thing.
Here's my code:
Rich (BB code):
; File Name: L1-Turn_on_LED.asm ; Date: 08-12-2010 ; Version: 0.1 ; Architechture: Baseline PIC ; Micro: 12F509
; Description: This code turns on an LED light
; Pin Assignment: GP01 output, END
; ****************************************************************************
list p=12F509 ; Specifies PIC to be used #include <p12f509.inc> ; Processor-specific header file
; Config Bits:
__CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC
; ****************************************************************************
; Reset Vector:
RESET CODE 0x3FF ; IntRC cal value stored at 0x3FF as 'MOVLW k' ; where 'k' is a literal value. movlw OSCCAL ; Move cal value in W to OSCCAL register
; Main Program ***************************************************************
start CODE
movlw b'111101' tris GPIO ; Set GP1 as Output
movlw b'000010' movwf GPIO ; Set GP1 to Output HIGH
goto $ ; Infinite loop
End
In my code,
Rich (BB code):
RESET CODE 0x3FF
tells the processor to execute the instruction ("movlw k") situated at 0x3FF, which copies the OSCCAL to W. Seeing as 0x3FF is the last memory address, Gooligum says that the "pointer" wraps back around to the first memory address (0x000h).
For some reason, in my simulation software (Real Pic Simulator) I get an "Out of Code" error generated from this line. I don't understand why this is happening. Even if (in simulation) the 0x3FF memory address is empty, the program should still wrap around to 0x000h and proceed, no?
I'm a total newbie so I ask that anyone kind enough to respond please consider that. I don't know much of the tech-jargon.
Help!