generate frequency using PIC10f204 timer0

Nagarathna

New Member
Hi,

idea : i want to generate 55khz frequency in the microcontroller pic10f204 using timer0 and internal oscillator 4Mhz.

problem : where will the output frequency be available ? what is the value that will generate this frequency i.e. the value written to timer0 register? can i have any c code for help.


Bye!
 
It can be done but the chip will not be able to do much else. The simplest way is a software loop that toggles a pin every 9 clock cycles.

Mike.
 
Last edited:
The 4mhz clock won't give you very good resolution. You could average a couple of soft loops like Pommie said, on either side of 55khz to give you the appearance of doing so.

Another option is writing a value to the OSCCAL register to fine tune the output on the GPIO pin. If you don't write down the factory OSCCAL setting. Or, if don't have a way to reestablish the OSCCAL value like provided on the Pickit 2 programmer, THEN DON'T DO IT!!!!!! Don't blame me if you brick your 10f204.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…