archanak2511
New Member
The program is intended to send "Hello" as an SMS to the specified number. Burnt the program into the PIC and set up the circuit using MAX232 and SIM300 gsm module. Did not get any message. Am pretty much sure that the hardware part is ok. I think the mistake ought to be with the program. I'm using PIC16F877A and Hi tech C compiler. I'm not very sure of the CONFIG bits and the #use line in the program. Please help me out by suggesting any possible corrections.
Code:
#include<htc.h>
#define _XTAL_FREQ 20000000
__CONFIG(0x37F2);
#use rs232 (baud = 9600, xmit=PIN_B0,rcv=PIN_B1,stream=GSM)
void transmit(unsigned char data);
void transmitn(unsigned int numb);
main()
{
TRISC=0b10000000;
SPBRG = 0x81; //Baud=9600 at 20 MHz
TXSTA = 0x24;
RCSTA = 0x90;
transmit("A");
transmit("T");
transmit("+");
transmit("C");
transmit("M");
transmit("G");
transmit("F");
transmit("=");
transmit("\"");
transmitn("9");
transmitn("8");
transmitn("4");
transmitn("6");
transmitn("0");
transmitn("5");
transmitn("1");
transmitn("2");
transmitn("5");
transmitn("6");
transmit("\"");
transmit("\n");
transmit("\r");
transmit("h");
transmit("e");
transmit("l");
transmit("l");
transmit("o");
transmit(0x1a);
}
void transmit(unsigned char data)
{
while(!TXIF);
TXREG = data;
}
void transmitn(unsigned int numb)
{
while(!TXIF);
TXREG = numb;
}