多路数据采集系统(Protues仿真)
if((v_tmp<51) & (v_tmp!=0)) {
if(v_tmp>v_max) v_max=v_tmp; }
v=v_max;
} void main() { int i;
LCD_Initial(); GotoXY(0,0);
Print(\ init(); count=0; while(1) {
i=1000; v=0; v_max=0;
Fre=0;
while(i)
{
adc_Convert(); lcd_show(); i--; }
} }
void lcd_show()//显示频率和电压 { GotoXY(1,1); B_TEMP[1]=v/10+'0'; B_TEMP[3]=v+'0';
if(Fre>999) B_TEMP[7]=(Fre/1000)+'0'; else
if(Fre>99) B_TEMP[8]=(Fre/100)+'0';else
21
B_TEMP[7]=' '; B_TEMP[7]=' ';
多路数据采集系统(Protues仿真)
}
//int0 interrupt
void timer1(void) interrupt 0 using 2//计数中断 {
F_count++;//add your code here }
if(Fre>9) B_TEMP[9]=(Fre/10)+'0';else B_TEMP[7]=' '; B_TEMP[10]=Fre+'0'; Print(B_TEMP);
//timer0/counter0 interrupt
void timer0(void) interrupt 1 using 1//定时计数频率 { TR0=0; TH0=0x40; TL0=0x6f; Fre=20*F_count; F_count=(Fre/1000); TR0=1; }
the main fun
void init(void)//计时器初始化,计数器初始化 {
IT0=1; //INT0下降沿中断 EX0=1; //允许INT1中断 TH0=0x40; TL0=0x6f; TMOD=0x01; ET0=1; TR0=1; EA=1; }
22
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库计算机控制课设——多路数据采集系统的设计(5)在线全文阅读。
相关推荐: