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 |
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]; |
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(); |
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 |
|
|
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(); |
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 // |