PIC16F676 <= Why does this program not work?

jayanthd

Joined Jul 4, 2015
945
Create a new project and copy paste the code and compile. It sometimes happens with mikroC PRO Compilers. maybe a bug of Compiler.
 

jpanhalt

Joined Jan 18, 2008
11,087
I see that, but you have set a 16-bit value for OSCCAL (3FF4). The largest allowed value for that register is 0xFC. Try the center value of 0x80.
You can check program memory for what was actually placed in the register. On that chip it is at 0x90 (Bank1)

John
 

Thread Starter

arashian1

Joined Sep 9, 2016
39
I see that, but you have set a 16-bit value for OSCCAL (3FF4). The largest allowed value for that register is 0xFC. Try the center value of 0x80.
You can check program memory for what was actually placed in the register. On that chip it is at 0x90 (Bank1)

John
i set osccal in mikroc OSCCAL = 0b11111100; and configuration in programmer software is 01F4 for 4MHZ internal oscilator

whats wrong with this settings?
 

jpanhalt

Joined Jan 18, 2008
11,087
i set osccal in mikroc OSCCAL = 0b11111100; and configuration in programmer software is 01F4 for 4MHZ internal oscilator

whats wrong with this settings?
I don't know. But it is said that a sane person would not keep trying the same thing that didn't work. I suggested changing OSCCAL to a more typical setting. jayantha suggested setting up a new project as sometimes that fixes a flaw.

I am not familiar with your development platform. You might try entering the binary value in hex.

John
 

jayanthd

Joined Jul 4, 2015
945
As mentioned jpanhalt 0x3FF4 is a 16 bit value and OSCCAL is a 8 bit register and so when PICKit 2 writes only 0xF4 to OSCCAl and discard 0x3F00. PICKit to is only showing that the 16 bit value is invalid which is true. Finally only the lower 8 bits of your value gets written to the register.

I checked your other thread and it says you are using very old version of mikroC which is a non PRO version. mikroC 8.2 had a lot of bugs and maybe that is causing the problem.
 
Top