avr pwm meres

pyxys1 pyxys1 at westel900.net
Sat Jul 31 17:13:41 CEST 2004



Szia,

2004. július 31., 16:03:49, írtad:

FA> Mega128-on 1 db:

FA> ICR1H=0x04;    //TOP value: ~1000
FA>  ICR1L=0xe0;
FA>  TCCR1A=b10000000;  //Channel A clear at up set at down, phase & freq
FA> correct pwm
FA>  TCCR1B=b00010001;  //phase & freq correct pwm, 1 prescaler
FA>  OCR1AH=0x00;   //COMP value
FA>  OCR1AL=0x00;


FA>     scanf("%u",&temp)
FA>      OCR1AH=temp>>8;
FA>      OCR1AL=temp;

bascom, 2 csatorna:

'===============================PWM==========================================
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down, Prescale = 8
enable interrupts

motor1 = 50
motor2 = 120

do
    Pwm1a = motor1
    Pwm1b = motor2

loop


--
Üdvözlettel,
 pyxys1                            
web:  www.eposz.co.hu
e-mail: pyxys at vnet.hu





More information about the Elektro mailing list