Continue task on sending SMS from GSM Modem. This is the simple program code to sending GSM modem. GSM doesn't response anything before because MAX232 IC was damaged. Today, i try the simple program code to ensure that the GSM modem is OK.
#include <pic.h>
#fuses hs, nowdt, noprotect, nobrownout
#use delay(clock=20000000)
#use rs232(baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7, bits=8, stream=GSM)
#int_rda
void serial_isr()
{
char c;
c=fgetc(GSM);
}
void main()
{
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
fprintf(GSM, "AT\n\r");
delay_ms(15000);
fprintf(GSM, "AT+CMGF=1\n\r");
delay_ms(3000);
fprintf(GSM, "AT+CMGS=\"+6**********\"\n\r");
delay_ms(3000);
fprintf(GSM, "hello FROM mcu");
putc(26);
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment