void main(void) { EnableInterrupts; SetBusCLK_40M(); // 设置时钟初始化。40MHz. SCI_Init(); AD_Init(); // AD初始化。 DDRM = 0X1F; //启动LCD LCD_start(); //初始化LCD模块 LCD_clear(); //清屏幕 LCD_startshow(); for(;;) { // TestSMinfo(); } }
int main(void) { char str[32]; unsigned int ad[4][10],i; RCONbits.SWDTEN = 0; //disable Watch dog timer initPLL(); while (OSCCONbits.CF == 1); //check clock failed while (OSCCONbits.COSC != 0b011); // Wait for Clock switch to occur while (OSCCONbits.LOCK == 0); //check PLL locked T1_Initial(); PORTS_Test_Initial(); ADC1_Initial(); InitializeLCM(); LATDbits.LATD11 = 1; /* turn the LCM back light */ ser1=0; ser2=0; ser3=0; ser4=0; ser5=0; ser6=0; LCD_start(); LCD_Delay200usX(5000); LCD_clear(); LCD_Delay200usX(5000); while (1) { ser1 = (ADC_read(1,DIVCOUNT)/341)*112; ser2 = ((ADC_read(2,DIVCOUNT)-217)/479)*124+217; ser3 = ((ADC_read(3,DIVCOUNT)-209)/481)*114+209; ser4 = ((ADC_read(4,DIVCOUNT)-308)/463)*115+308; ser5 = ((ADC_read(5,DIVCOUNT)-237)/184)*46+237; ser6 = ((ADC_read(6,DIVCOUNT)-246)/411)*105+246; LCD_Cursor_New(0, 0); //sprintf(str, "timer1.count: %d ",timer1.count); //putsLCD((unsigned char*)str); putsLCD("Final Prj. TEAM 12 "); LCD_Cursor_New(1, 0); sprintf(str, "AD1: %5d AD2:%5d",ser1,ser2); putsLCD((unsigned char*)str); LCD_Cursor_New(2, 0); sprintf(str, "AD3: %5d AD4:%5d",ser3,ser4); putsLCD((unsigned char*)str); LCD_Cursor_New(3, 0); sprintf(str, "AD5: %5d AD6:%5d",ser5,ser6); putsLCD((unsigned char*)str); } }
int main(void) { char str[32]; int temp_ms, temp_sec; RCONbits.SWDTEN = 0; //disable Watch dog timer initPLL(); while (OSCCONbits.CF == 1); //check clock failed while (OSCCONbits.COSC != 0b011); // Wait for Clock switch to occur while (OSCCONbits.LOCK == 0); //check PLL locked T1_Initial(); PORTS_Test_Initial(); keypad_init(); ADC1_Initial(); initPWM(); InitializeLCM(); LATDbits.LATD11 = 1; /* turn the LCM back light */ int a; LCD_clear(); LCD_start(); delay200usX(2*5000); LCD_clear(); while (1) { /* PWM */ infoPWM(); a = keypad_task(); /* LCD_Cursor_New(0, 12); sprintf(str, "%d",a); putsLCD((unsigned char*)str); *//* if(a==1){P1DC1 = 749; } if(a==2){P1DC1 = 3124; } if(a==3){P1DC1 = 4999; } if(a==4){P1DC1 = 6249; } */ if(a==1){P1DC1 = 1499; } if(a==2){P1DC1 = 6249; } if(a==3){P1DC1 = 9999; } if(a==4){P1DC1 = 12499; } } }