
อยากทราบว่าไอเจ้า ATtiny85 อะคับ มันจะขับ PWM ในหลัก kHz ได้ไหม ต้องต่อ Crystal ด้วยไหม มือใหม่อะคับ
ครับ อ้างอิงจากเว็บนี้ http://www.re-innovation.co.uk/web12/index.php/en/blog-75/305-fast-pwm-on-attiny85
ปกติจะได้ 20Khz ที่ crystal 8 MHz
The output frequency is 8MHz, our pre-scalar is 1 and the output will roll over when we have reached a value of hex FF = 256, so we will have an output frequency of 8Mhz/ (1x 256) = 31.25kHz.
สามารถเขียนโคดให้ได้สูงถึง 31.25Khz
Here are some 'scope waveforms of the outputs.
This is the 50% duty cycle PWM on pin 5 (OC0A). As expected we get an output of around 31.25kHz (this scope is not too accurate).
1 |