int main(void) { DrvUART_Close(UART_PORT0); //------------------ Init(); Initial_pannel(); clr_all_pannal(); while(1) { seg_display(hitung); /*UNLOCKREG(); SYSCLK->PWRCON.XTL12M_EN = 1;//Enable 12MHz Crystal SYSCLK->CLKSEL0.HCLK_S = 0; LOCKREG();*/ servo_tutup(); //DrvSYS_Delay(10); Initial_pannel(); DrvGPIO_ClrBit(E_GPD, 14); print_lcd(0,"Selamat Datang"); print_lcd(1,"1. Kumpul Borang"); print_lcd(2,"2. Absen Doang"); print_lcd(3," > Silakan Tekan:"); //DrvSYS_Delay(10000); key=Scankey(); while(key==4){ bacarfid(); } while(key==1){ kumpul(); } while (key==2){ absen(); print_lcd(2,"3. ADC="); DrvADC_StartConvert(); adc=DrvADC_GetConversionData(7); Show_Word(3,5,adc/1000+'0'); Show_Word(3,6,adc%1000/100+'0'); Show_Word(3,7,adc%100/10+'0'); Show_Word(3,8,adc%10+'0'); } DrvGPIO_SetBit(E_GPC,12); DrvSYS_Delay(1000); } }
void print_lcd(unsigned char line, char *str) { int i=0; do{ Show_Word(line,i,*str++); i++; if(i>15) break; } while(*str!='\0'); }