Hi,
i am using mikroC as compiler and i want to program pic18f4550 .whenever i try to use delay functions of mikroC it produces wrong delays.For example i wrote
Delay_ms(10);
it produces 1 seconed delay
can anyone help me?
Hi,
i am using mikroC as compiler and i want to program pic18f4550 .whenever i try to use delay functions of mikroC it produces wrong delays.For example i wrote
Delay_ms(10);
it produces 1 seconed delay
can anyone help me?
When you open your project, on the left hand side you have "clock" field where you need to put the speed your uC is running on. You can also go to project properties and set it there. Note that this is not always equal to the crystal speed.
For example, if you use PLL and your crystal is 10MHz the uC will run on 40MHz and not on 10MHz hence you have to enter 40000000 in that field and not 10000000.
The delay_*() functions generate delay loop relating to this field so if you enter wrong value there, all delay* functions will create "wrong" delay.