Can't find code error

Status
Not open for further replies.
I am definitely getting a 4 mhtz oscillator chip instead of using the intosc. Interestingly enough the new serial routine transmits at 19,200 baud and works. The old one was 9600 baud. The oscillator for the old chip must have been a lot worse then the new chip's oscillator.
 

Presumably the new one has it's correct OSCCAL value?, with any random value in the old one it could be anywhere! - I see no reason to suspect the old one is any different to the new one - both require the correct OSCCAL value writing to the register to meet their design accuracy.

The internal oscillator should be fine at 19,200 baud, it's hardly worth losing the I/O by using an external oscillator.
 
The OSCCAL value is not written to the OSCCAL register at the factory is it? Since I never wrote the retrieved the correct value from the last byte of program memory, the osc is still not calibrated. Unfortunately I erased the chip (including the OSCCAL value) when I programmed it. Arrg.
 

What did you use to program it?, the programmer software 'should' read and restore the OSCCAL value - which is stored in the very highest word of memory. The first action of your program should be to copy this to the OSCCAL register, see the datasheet for details.
 
Ah and the programming software (ICPROG) does read the value, and asks if you want to keep what it read or what is in your program file. I made a mistake though. I went to program the PIC and realized I didn't load the edited code into the buffer (It was late :lol: ) Well I hit program, and when I noticed my mistake, I stopped the reading process intending to cancel the programming. Well all I canceled was the read, and next came the erase process. So it never prompted me whether I wanted to keep the data or erase it. So bye bye went the OSCCAL data amidst a flash of electrical impulses. :lol:
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…