推荐回答
#include#includevoid Delayusunsigned int t;void INT0_isrvoid;void Init_PORTvoid;void INT0_initvoid;unsigned int select_num,num;unsigned int pl,zkb;const unsigned char sin_tab={0x3F,/*0*/0x06,/*1*/0x5B,/*2*/0x4F,/*3*/0x66,/*4*/0x6D,/*5*/0x7D,/*6*/0x07,/*7*/0x7F,/*8*/0x6F/*9*/};void Delayusunsigned int t{WDR;dot--;whilet>1;WDR;}void Init_PORTvoid{PORTA = 0XFF;DDRA = 0X00;PORTB = 0X00;DDRB = 0XFF;PORTC = 0X00;DDRC = 0XFF;PORTD = 0XF4;//0000 0100DDRD = 0XFB;}void INT0_initvoid{SREG|=BIT7;MCUCR|=0x02;GICR|=BIT6;GIFR|=BIT6;}#pragma interrupt_handler INT0_isr:2void INT0_isrvoid{PORTB|=BIT0;Delayus100;num=PINA&0X1F;ifnum==0x1E{select_num++;//0001 1110ifselect_num>=4select_num=0;}ifnum==0x1Cpl++;ifnum==0x1Bpl--;ifnum==0x17zkb++;ifnum==0x0Fzkb--;}void mainvoid{unsigned int ii,jj,nn,mm,kk=100;Init_PORT;INT0_init;while1{ifselect_num==0{forii=0;ii0;nn--//产生下降波{PORTD&=~BIT0;PORTC=nn;//A口输出下降波PORTD|=BIT0;Delayuskk;//延时}}ifselect_num==3{ifmm==0mm=256;PORTD&=~BIT0;PORTC=mm--;PORTD|=BIT0;Delayuskk;}}。
黄砚华2019-11-03 18:18:04
提示您:回答为网友贡献,仅供参考。