• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

generate frequency using PIC10f204 timer0

Not open for further replies.


New Member

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.



Well-Known Member
Most Helpful Member
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.

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.
Not open for further replies.

EE World Online Articles