mitxela.com forum
Welcome. Please log in or register.

140 khz square wave on the atmega328
DAVID Posted: 28 Oct 2018, 08:13 PM
Avatar
I love mcus

Member
Posts: 237
Joined: 10-September 17
hi, since past year i was doing a mist maker with arduino/atmega328
but i was not able to create the required 140 khz, how can i create one?

-------------
[top]
mit Posted: 29 Oct 2018, 05:44 PM
Avatar
yeah whatever

Admin
Posts: 540
Joined: 4-May 16
140kHz should not be too hard to produce. You could probably do it with delay routines and toggling pins, but the proper way to do it is with one of the hardware timers.

Page 99 of the atmega328p datasheet says this about timer 0:

(User posted image)


It takes a bit of poking around with the registers to configure it right, but with this there should be no problem generating any frequency up to 8Mhz.

-------------
[top]

Sign in to post a reply.