⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chuankou.i

📁 AVR单片机mega16的串口通信程序下载。
💻 I
字号:
#line 1 "E:\刘滨\程序\串口\chuankou.c"
#line 1 "D:/PROGRA~1/ICC_AVR/include/iom16v.h"




#line 7 "D:/PROGRA~1/ICC_AVR/include/iom16v.h"


#line 10 "D:/PROGRA~1/ICC_AVR/include/iom16v.h"


#line 13 "D:/PROGRA~1/ICC_AVR/include/iom16v.h"


#line 16 "D:/PROGRA~1/ICC_AVR/include/iom16v.h"
























































































































































































































































































































































































































































































































#line 2 "E:\刘滨\程序\串口\chuankou.c"




unsigned int count,i;
unsigned int j;

void SETB(unsigned char k)
{
(*(volatile unsigned char *)0x38)=(*(volatile unsigned char *)0x38)|(1<<k);
}

void CLRS(unsigned char l)
{
(*(volatile unsigned char *)0x38)=(*(volatile unsigned char *)0x38)&amt;~(1<<l);
}





void Display(unsigned char Data,unsigned char position)
{
unsigned char DataPos=~0;
unsigned char num=~0;
unsigned char wait=~0;
unsigned char datanum=~0;
unsigned int transdata=~0;
unsigned int iToDIO=~0;
unsigned char cToDIO=~0;
(*(volatile unsigned char *)0x37)=0xFF;
SETB(3);
SETB(0);
SETB(2);
datanum=2;
CLRS(0);
if(Data!=0xA4)
{
DataPos=0xC8+position-1;
transdata=DataPos;
transdata=transdata<<8;
transdata=transdata+Data;
while(datanum--)
{
wait=25;
while(wait--)
{;}
for(num=0;num<8;num++)
{
while(wait--)
{;}
CLRS(1);
wait=4;
while(wait--)
{;}
}
}
}
else
{
wait=25;
while(wait--);
for(num=0;num<8;num++)
{
cToDIO=Data&amt;0x80;
Data=Data<<1;
if(cToDIO==0x00)
{
CLRS(2);
}
else
{
SETB(2);
}
SETB(1);
wait=4;
while(wait--);
CLRS(1);
wait=4;
while(wait--);
}
}
SETB(0);
}

unsigned int ADC_Conv(void)
{
unsigned int temp1,temp2;
temp1=(unsigned int)(*(volatile unsigned char *)0x24);
temp2=(unsigned int)(*(volatile unsigned char *)0x25);
temp2=(temp2<<8)+temp1;
return temp2;
}


void main()
{
(*(volatile unsigned char *)0x27)=0x00;
(*(volatile unsigned char *)0x26)=0xE6;

Display(0xA4,0xff);
while(1)
{
count=20000;
while(count--);
i=ADC_Conv();
for(j=0;j<4;j++)
{
Display(i>10,j+1);
if(i!=0)
{
i=i/10;
}
}
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -