Hello. I'm using SDCC to develop a small program to control relays wich a 12F675 or 629 .
I like to know how I could read the oscilator calibration value from FLASH program memory at 3ff in the program, to assign these value to OSCCAL ragister.
Actually I'm putting these value directy in the register at the begin of main function, but I need read these value from the program flash, because I will flash around thousand of pics, and I can't manully reading these value and changing the program for every one!!!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
should do the trick. Maybe you also need to declare `calibration` as volatile, but I doubt it.
I cannot currently test this, so please report whether this helped you out or not.
Best regards
Raphael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello. I'm using SDCC to develop a small program to control relays wich a 12F675 or 629 .
I like to know how I could read the oscilator calibration value from FLASH program memory at 3ff in the program, to assign these value to OSCCAL ragister.
Actually I'm putting these value directy in the register at the begin of main function, but I need read these value from the program flash, because I will flash around thousand of pics, and I can't manully reading these value and changing the program for every one!!!
I think
#include <pic14regs.h>
static __code unsigned char __at(0x3ff) calibration;
void main(void) {
OSCCAL = calibration;
}
should do the trick. Maybe you also need to declare `calibration` as volatile, but I doubt it.
I cannot currently test this, so please report whether this helped you out or not.
Best regards
Raphael