E题-报告3-程序清单 | ||||
| ||||
E题-报告3-程序清单 int main(void) { while(1) { for(step=0;step<201;step++) { on; if(step==200) { step=0; } AD9850_Write_Parallel(0,87890+step*97.66);//0.25ms ad_value=(float)ADC_ConvertedValue/4096*3.3; adc_zheng=(u8)ad_value; adc_xiaoshu=ad_value*100-adc_zheng*100; LCD_ShowxNum(132,10,adc_zheng,1,16,0); LCD_ShowxNum(148,10,adc_xiaoshu,2,16,0); POINT_COLOR=WHITE; LCD_DrawLine(15+step*1.5+1.5, 50, 15+step*1.5+1, 225); POINT_COLOR=BLACK; LCD_DrawLine(15+step*1.5, 225-ad_value*50, 15+step*1.5+1, 225); //1.8ms Delay_ms(20); Delay_us(270); key=keyscan();//0.02ms if(key==65&&key_init==102) flag_stop=1; else if(key==42&&key_init==102) flag_stop2=1; key_init=key; while(flag_stop) { u8 key=102,flag_22=0; if(keyscan()==1) {key_init=102,flag_stop=0;} key=keyscan(); while(key==68) {LCD_Clear(WHITE);LCD_Display_init();flag_stop=0;break;} while(key==0||key==1||key==2||key==3||key==4||key==5||key==6||key==7||key==8||key==9) { u16 a=0,b=0,flag_exit21=0; LCD_Clear(WHITE); POINT_COLOR=BLUE; LCD_Display_Dir(1); LCD_ShowString(50, 226, 160, 160, 12, "Set_Freq:"); LCD_ShowString(180, 226, 160, 160, 12, "/100KHz"); LCD_DrawLine(15, 45, 15, 225); LCD_DrawLine(15, 225, 315, 225); LCD_DrawLine(15, 45, 13, 47); LCD_DrawLine(15, 45, 17, 47); for(j=15;j<315;j=j+15) { LCD_DrawLine(j+15,220,j+15,225); } for(i=0;i<180;i=i+15) { LCD_DrawLine(15,225-i, 20, 225-i); LCD_ShowxNum(2,220-i,i/5,2,12,0); //×Y×?±ê?-?ì?? ??ê?êy×? } LCD_ShowString(2,10,160,160,12,"/0.1V"); for(i=0;;i++) { while(keyscan()=='f'); if (keyscan()=='#'){Delay_ms(20); break;} else { a=keyscan(); if(a==68) {flag_exit21=1; break;} Delay_ms(400); LCD_ShowNum(120+10*i,226,a,1,16); b=10*b+a; } AD9850_Write_Parallel(0,b*98.146); } if(flag_exit21==1) break; while(1) { POINT_COLOR=BLUE; ad_value=(float)ADC_ConvertedValue/4096*3.3; sprintf(ADVALUE,"ADC:%0.2f V",ad_value); LCD_ShowString(100,10,160,160,16,ADVALUE); POINT_COLOR=WHITE; LCD_DrawLine(120, 30, 120, 225); POINT_COLOR=BLUE; LCD_DrawLine(120, 225-ad_value*50, 120, 225); if(keyscan()==68) break; } Delay_ms(500); } if(keyscan()==68) break; while(key==66||key==67) { LCD_Clear(WHITE); LCD_Display_Change_Scan_Time_init(); while(1) { for(i=0;;i++) { while(keyscan()=='f'); if (keyscan()=='#'){Delay_ms(20); break;} if(TIME==5) TIME=0; if(keyscan()==66) TIME=TIME+1; else if(keyscan()==67) TIME=TIME-1; Delay_ms(500); if(TIME==5) TIME=0; if(TIME==0) TIME=5; if(TIME==255) TIME=4; POINT_COLOR=BLUE; LCD_ShowxNum(280,12,TIME,1,12,0); POINT_COLOR=BLACK; } for(step=0;step<201;step++) { on; if(step==200) { step=0; } AD9850_Write_Parallel(0,87890+step*97.66);//0.25ms ad_value=(float)ADC_ConvertedValue/4096*3.3; } } |