|
Mobil_surveillance_system 1
|
00001 #include "Init.h" // due to: __low_level_init function 00002 #include "Timer.h" // due to: Timer_timerAInit and Timer_timerAUpStart functions 00003 #include "UART1.h" // due to: UART1 functions 00004 #include "UART2.h" // due to: UART2 functions 00005 #include "GPS.h" // due to: GPS functions 00006 #include "GPRS.h" // due to: GPRS functions 00007 00008 00009 00011 00018 //***************************************************************************** 00019 // 00020 // Main program 00021 // 00022 //***************************************************************************** 00023 00024 void main(void){ 00025 00026 // this function will be handled before memory is initialized 00027 __low_level_init(); 00028 // stop watchdog timer 00029 WDTCTL = WDTPW + WDTHOLD; 00030 // set Timer A offset value 00031 Timer_timerAInit(); 00032 // start Timer A, after this 00033 Timer_timerAUpStart(); 00034 // Init uart1 00035 UART1_initUART1(); 00036 // Init uart2 00037 UART2_initUART2(); 00038 // Init gps module 00039 GPS_initGPS(); 00040 // Init gprs module 00041 GPRS_initGPRS(); 00042 00043 while(1){ 00044 00045 GPS_executeGPS(); 00046 00047 GPRS_executeGPRS(); 00048 00049 if(ge_tbUART1RXITFLAG){ 00050 00051 // first we have to clear the flag that has been set in the USCI1RX_ISR rutin 00052 ge_tbUART1RXITFLAG = 0; 00053 UART1_read(); 00054 00055 } 00056 00057 if(ge_tbUART1TXITFLAG){ 00058 00059 // first we have to clear the flag that has been set in the USCI1TX_ISR rutin 00060 ge_tbUART1TXITFLAG = 0; 00061 UART1_sendChar(); 00062 } 00063 00064 if(ge_tbUART2RXITFLAG){ 00065 00066 // first we have to clear the flag that has been set in the USCI1RX_ISR rutin 00067 ge_tbUART2RXITFLAG = 0; 00068 UART2_read(); 00069 00070 } 00071 00072 if(ge_tbUART2TXITFLAG){ 00073 00074 // first we have to clear the flag that has been set in the USCI1TX_ISR rutin 00075 ge_tbUART2TXITFLAG = 0; 00076 UART2_sendChar(); 00077 } 00078 00079 // go to sleep 00080 _bis_SR_register(LPM3_bits); 00081 } 00082 }
1.7.4