DO this work for GSM transmission...
by barkkathulla[ Edit ] 2012-09-22 11:40:18
#include <reg51.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define BAUD 0xFD // 9600 baud rate
#define TRIGER 0
#define ECHO 1
#define _AT 1
#define _ATZ 2
#define _CSQ 3
#define _CMGF 4
#define _CMGS 5
#define _CMGR 6
#define _CMGD 7
typedef unsigned char byte; /* type define objects with */
typedef unsigned int word; /* more classical microprocessor */
byte Tim1val;
bit TIM1;
byte ticks;
bit togle;
idata char buff[41];
void putch(char ch);
void sputs(char*s);
void getline(char*s,byte buffmax);
byte decode_cmd(char*s);
/*
use the free-running timer
at approx. 70ms interval.
*/
void timer0() interrupt 1 using 1
{
TR0=0;
ET0=0;
TR0=1;
++ticks;
if(ticks==40)
{
togle=1;
ticks=0;
}
if(TIM1==TRIGER){
if(++Tim1val==20)TIM1=1; // 1sec delay for serial get_char
}
ET0=1;
}
void main(void){
byte i,result;
EA = 0;
TMOD =0x20; // tim1 auto re load mode
TH1=TL1=BAUD;
PCON =0;
// SCON =0x50; // Mode 1(variable) REN=1;
// TI =0;