برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی

برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

داده هایی در مورد برق، الکترونیک، الکتروتکنیک، مکاترونیک، پزشکی، کشاورزی و

تبلیغات
آخرین نظرات

راه اندازی تایمر میکروکنترلرهای avr

ShahBaz | دوشنبه, ۵ مرداد ۱۳۹۴، ۰۵:۳۸ ب.ظ

To change the frequency you have to change TCCR1 Registers

To change the pulse width you need to modify the OCR1 Registers

OCR1A and OCR1B are 8 bit registers. You can't load value more than 255.

By the way how did you calculated OCR1 for the value 2500??


You can't change the frequency individually, if you use one timer then you can only get one frequency.
The two compare registers can be loaded with two different values to give two different duty ratios but with the same frequency.
Depending on the PWM mode, if you use top=ICR1 ( instead of a fixed top 0xff/0h1ff/0h3ff ) then you can also change the PWM from the value of ICR1

The frequency and duty ratio depend on the mode and values used

In fast PWM top=ICR1, the output PWM frequency=timer clock/(ICR1+1) and the duty=OCR1A(B)/ICR1
In fast PWM top=0h00ff, the output PWM frequency=timer clock/256 and the duty=OCR1A(B)/256
In fast PWM top=0h01ff, the output PWM frequency=timer clock/512 and the duty=OCR1A(B)/512
In fast PWM top=0h03ff, the output PWM frequency=timer clock/1024 and the duty=OCR1A(B)/1024

In phase correct or phase & freq correct top=ICR1, the output PWM frequency=timer clock/(ICR1*2) and the duty=OCR1A(B)/ICR1
In phase correct or phase & freq correct top=0h00ff, the output PWM frequency=timer clock/(255*2) and the duty=OCR1A(B)/256
In phase correct or phase & freq correct top=0h01ff, the output PWM frequency=timer clock/(511*2) and the duty=OCR1A(B)/512
In phase correct or phase & freq correct top=0h03ff, the output PWM frequency=timer clock/(1023*2) and the duty=OCR1A(B)/1024



نظرات  (۰)

هیچ نظری هنوز ثبت نشده است

ارسال نظر

ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی