/[H9]/trunk/Embedded/main.c
ViewVC logotype

Diff of /trunk/Embedded/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 200 by hedin, Thu Dec 6 14:19:51 2007 UTC revision 201 by hedin, Sun Dec 9 15:07:32 2007 UTC
# Line 6  Line 6 
6    
7  #include "lcd.h"  #include "lcd.h"
8  #include "Delay.h"  #include "Delay.h"
 // Delay.h is included inside lcd.c  
9    
10  #define BUFFER 128  #define BUFFER 128
11  #define PWRFAIL RB1  #define PWRFAIL RB1
# Line 152  void rs232_init(void) Line 151  void rs232_init(void)
151          RCSTA   = 0x90; // 0x90 enables SPEN and CREN in the RCSTA register          RCSTA   = 0x90; // 0x90 enables SPEN and CREN in the RCSTA register
152  }  }
153    
154  void sms_init(void)  void modem_init(void)
155  {  {
156          int i;          int i;
157          char buf[2];          char buf[2];
# Line 405  void on_recieve(void) Line 404  void on_recieve(void)
404          if (strstr(global_message_buffer1,"CMTI") != 0) // here we handles a incomming SMS          if (strstr(global_message_buffer1,"CMTI") != 0) // here we handles a incomming SMS
405          {          {
406                  ptr = strstr(global_message_buffer1,",");       // finds the point just before the nr. of the SMS.                  ptr = strstr(global_message_buffer1,",");       // finds the point just before the nr. of the SMS.
407                  strcat(tmp,ptr+1);                                                      // puts that number in tmp                  strcat(tmp,ptr+1);                      // puts that number in tmp
408                  global_sms_recieve_number[0] = 0;                       // wanna be sure that we write the new number from global_sms_recieve_number[0]                  global_sms_recieve_number[0] = 0;       // wanna be sure that we write the new number from global_sms_recieve_number[0]
409                  strcat(global_sms_recieve_number, tmp);         // puts the sms number into the global variable.                  strcat(global_sms_recieve_number, tmp); // puts the sms number into the global variable.
410                  sms_recieved();                  sms_recieved();
411          }                }      
412          reset_recieve_buffer();          reset_recieve_buffer();
# Line 455  void sms_recieved(void) Line 454  void sms_recieved(void)
454                                    
455                  global_time_interval = atoi(buf);                  global_time_interval = atoi(buf);
456                  global_time_interval *= 60;                  global_time_interval *= 60;
457                  eeprom_writer();                        // writes the new cell nr. and time interval to the eeprom.                  eeprom_writer();  // writes the new cell nr. and time interval to the eeprom.
458                  send_sms("conf ok");                  send_sms("conf ok");
459          }          }
460                    
# Line 476  void main() Line 475  void main()
475    
476          // Running init for various components.          // Running init for various components.
477          pic18_io_init();          pic18_io_init();
478          RA5 = 1;                        // Indicates that the board is running inits.          RA5 = 1;                // Indicates that the board is running inits.
479                    
480          rs232_init();          rs232_init();
481          ad_init();          ad_init();
# Line 485  void main() Line 484  void main()
484          lcd_home();          lcd_home();
485          interrupt_init();          interrupt_init();
486          timer_init();          timer_init();
487          sms_init();          modem_init();
488          eeprom_reader();          eeprom_reader();
489  ///////////////  ///////////////
490  // Main loop //  // Main loop //

Legend:
Removed from v.200  
changed lines
  Added in v.201

  ViewVC Help
Powered by ViewVC 1.1.20