程序编译的时候没有错误!
#include<iom16v.h>
#define uchar unsigned char
#define uint unsigned int
#include<macros.h>
unsigned char LED7Code[]= {~0x3F,~0x06,~0x5B,~0x4F,~0x66,~0x6D,~0x7D,~0x07,~0x7F,~0x6F,~0x77,~0x7C,~0x39,~0x5E,~0x79,~0x71};
void delay(int i)
{
char j;
for(;i>0;i--)
for(j=0;j<100;j++);
}
void chushi()
{ PORTC=0xff;
DDRD=0Xff;
SREG=0x80;
DDRA&=~BIT(0);
PORTA&=~BIT(0);
ADMUX=0x40;
ADCSRA=0xe8;
SFIOR=0x00;
SREG=BIT(7);
SPCR=0X57;
delay(10);
while(1);
}
void disp(uchar i,uchar j,uchar k,uchar m)
{ PORTD=BIT(0);
PORTC=LED7Code[i];
delay(10);
PORTD=BIT(1);
PORTC=LED7Code[j];
delay(10);
PORTD=BIT(2);
PORTC=LED7Code[k];
delay(10);
PORTD=BIT(3);
PORTC=LED7Code[m];
delay(10);
}
void chuandi(uint i,uint j)
{
uint t0,t1,t2,t3,t4;
t0=i*255+j;
t1=t0/1000;
t2=t0%1000/100;
t3=t0%1000%100/10;
t4=t0%1000%100%10;
disp(t1,t2,t3,t4);
}
void main()
{
chushi();
}
#program intrrput_hander dac1:15
void dac1(void)
{ uint t0,t1,t2,t3,t4;
uint adcl,adch;
adch=ADCH;
adcl=ADCL;
chuandi(adch,adcl);
}
高手帮我解决!谢谢了
-
一周热门 更多>