|
هل محتاج تثبت التردد وتغير duty cycle ؟؟ ولو كده كام التردد اللي محتاجة ؟؟ وهل لازم at90s2313 ولا ممكن تستعمل atmega8 ??
|
| و الكود عندي بس محتاج شرح لكل تعليمة بالتفصيل AT90S2313 حصرا
أخي جزاك الله كل خير
#include<90s2313.h>
#include<delay.h>
void main(void) {
unsigned char decode[10]={0x77,0x06,0xb3,0x97,0xc6,0xD5,0xf5,0x07,0xf7,0xD 7};
unsigned char OCR1H_[10]={0x03,0x03,0x03,0x03,0x03,0x02,0x02,0x01,0x01,0x0 0};
unsigned char OCR1L_[10]={0xff,0xfa,0xf4,0xf0,0x80,0xf0,0x00,0xf00,0x00,0x 00};
unsigned char q=0,t=0;
PORTB=0x00;
DDRB=0xFF;
PORTD=0x7f;
DDRD=0x00;
TCCR0=0x00;
TCNT0=0x00;
TCCR1A=0xc3;
TCCR1B=0x04;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1H=0x03;
OCR1L=0xff;
PORTB|=decode[t];
while(1)
{
if(PIND.5==0&&q==0&&t!=0)
{
t--;
OCR1H=OCR1H_[t];
OCR1L=OCR1L_[t];
PORTB&=8;
PORTB|=decode[t];
q=1;
}
if(PIND.4==0&&q==0&&t!=9)
{
t++;
OCR1H=OCR1H_[t];
OCR1L=OCR1L_[t];
PORTB&=8;
PORTB|=decode[t];
q=1;
}
if(PIND.6==0&&q==0&&t!=9)
{
while(t!=9)
{
t++;
OCR1H=OCR1H_[t];
OCR1L=OCR1L_[t];
PORTB&=8;
PORTB|=decode[t];
delay_ms(100);
}
}
if(PIND.5==1&&PIND.4==1)
q=0;
};
}