Go Down

Topic: attiny45/85 frequentie (Read 2116 times) previous topic - next topic


is it posible to program the atinny45/85
to generate a pwm pulse of 10-20mhz

if it can that i would be glad

easy said


it is for hacking devices


The maximum clock rate on the ATtiny is 20 MHz.  If you run it at 20 MHz you can have one of the Timer/Counter sections produce  a 10 MHz square wave on an output pin.  To get PWM you'd have to go slower.  For example to get 16 levels of PWM you'd have to  bring the frequency down to 1.25 MHz (20/16).
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


well i need a free adjustable puls that can range forom 0-20Mhz
i want to use it to simulate a crystal
and i beleve a cristal is just a fast on/off signal
(o that isnt pwm) SORRY

so can you help


A continuously variable clock from 0 Hz to 20 MHz is outside the capability of a microprocessor.  I suspect an oscillator made with some CMOS inverters, a capacitor and a ten-turn variable resistor would give you better control over such a wide range.  Read about such things here: http://www.fairchildsemi.com/an/AN/AN-118.pdf
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


The attiny and other microcontrollers use their crystal controlled clock to generate their PWM signal. They are therefore restricted to producing a maximum signal that is at least half as much as their clock frequency.

With 20Mhz crystal controlled micro controller and software signal generator you might be able to generate from 0 to 10Mhz ( as mentioned by johnwasser)

I see two ways to do what you want...
The hard way:
If I wanted to step through various crystal values I would start with both a 20 and a 16 in circuit and feed them through an AND gate (to act as a switch) then into a 74HC161 to act as a divider and back through the AND gate to switch the divider output.

You could then get 20, 16, 10, 8, 5, 4, 2.5 and 2 and you could run your micro off the 20Mhz and generate anything you wanted below that using it's software.

The easy way:


The AtTiny 25/45/85 has an internal 64MHz PLL clock that can be used as input to timer1. Using this timer you can generate frequencies starting from 32MHz and downwards as follows:

32 / 1 = 32
32 / 2 = 16
32 / 3 = 10.67
32 / 4 = 8
32MHz / 256 = 125kHz

This capability does not require an external crystal.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131