00001 /********************************************************* 00002 * Function: main service loop 00003 * 00004 * File: main.c 00005 * Author: Book Chen 00006 * Date 2009.07.06 00007 *********************************************************** 00008 */ 00009 #include "includes.h" 00010 #include "configbit.h" 00011 00012 void main(void){ 00013 INT32U j; 00014 00015 GIEH=0; // disable all high priority interrupt 00016 GIEL=0; // disable all low priority interrupt 00017 IPEN=0; // disable interrupt priority 00018 for(j=0;j<100000;j++); // delay for power stable 00019 // **87j10 driver initial 00020 GpioInit(); // pic18f87j10 hardware driver 00021 InterruptInit(); // pic18f87j10 hardware driver 00022 Uart1Init(); // pic18f87j10 hardware driver 00023 Timer0Init(); // pic18f87j10 hardware driver 00024 Timer1Init(); // pic18f87j10 hardware driver 00025 // **device driver initial 00026 LedInit(); // led device driver using gpio 00027 KeyInit(); // keys device driver using gpio 00028 LcmInit(); // lcm device driver using gpio and timer 1 00029 // **application 00030 MenuInit(); 00031 ShellInitial(); // shell application 00032 IPEN=1; // enable interrupt priority 00033 GIEH=1; // enable all high priority interrupt 00034 GIEL=1; // enable all low priority interrupt 00035 while(1){ 00036 MenuSvc(); // menu system 00037 ShellSvc(); // a simple shell using uart1 00038 LedSvc(); // display firmware running led 00039 } 00040 }