phrbob93
Member level 1

- Joined
- Mar 28, 2014
- Messages
- 38
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Location
- Jalandhar, punjab
- Activity points
- 343
iam doing a project on sms sending through gsm
using SIM 900 module and 8051
My code is:
the problem here is SMS won't send by the GSM
when i use the calling function by replacing the AT commands then calling works
but SMS won't.. i think iam wrong in sending AT commands for SMS... please correct me
using SIM 900 module and 8051
My code is:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 #include<reg51.h> unsigned char *command = "AT"; unsigned char *echo = "ATE0"; unsigned char *msgConfig = "AT+CMGF=1"; unsigned char *number = "AT+CMGS=\"8283******\""; unsigned char *message = "hello"; unsigned char *CTRLZ = 0x1A; void serial_init(void); void serial(unsigned char); void puts(unsigned char *p ); void delay(void); void main() { serial_init(); puts(command); delay(); // delay of approx 1 sec puts(echo); delay(); puts(msgConfig); delay(); puts(number); delay(); puts(message); delay(); puts(CTRLZ); while(1); } void serial_init(void) { TMOD=0x20; //timer 1, mode 2(8-bit autoreload) to set baud rate TH1=0xFD; //-3 to TH1 for 9600 baud rate SCON=0x50; // 8 bit txion, 1 start 1 stop bit, REN enable for both txfr and rxve TR1=1; // start timer } void puts(char *p) { char *temp = p; /*temp pointer so that the actual pointer is not displaced */ while(*temp != 0x00) { serial(*temp); temp++; } } void serial(unsigned char x) { SBUF=x; while(TI==0); TI=0; } void delay(void) // delay for approx 1 sec { int i; TMOD=0x01; // timer 0 in mode 1 for(i=0;i<142;i++) { TL0=0x00; // starting value from 0 TH0=0x00; TR0=1; // sart timer while(TF0==0); // polling TF flag for high TR0=0; // stop timer TF0=0; // clear flag TF0 //} } }
the problem here is SMS won't send by the GSM
when i use the calling function by replacing the AT commands then calling works
but SMS won't.. i think iam wrong in sending AT commands for SMS... please correct me
Last edited by a moderator: