GSM MODEM with 8051
Thu Jan 13 2011, 05:56 pm
I have made little change in the code. I have kept test strings to check where the program is flowing.
I think tx0(0x1A) ctrl+z line is not working properly.
while(1) { while(key!=1) { if(flag==0) { lcdcmd(0x80); lcdstr("MSG Sent"); SMSString("AT+CMGS=\"9845xxxxxx\"\r"); delay(1); SMSString("This is a test msg \r"); tx0(0x1A); flag=1; } } lcdcmd(0x80); lcdstr("MSG Not sent"); flag=0; }
I think tx0(0x1A) ctrl+z line is not working properly.
Fri Jan 14 2011, 10:26 pm
try in this manner
here 9845xxxxxx ru use xxxxx or any number
use number
SMSString("AT+CMGS=\"9845xxxxxx\"\r");
tx0(0x1A);
SMSString("This is a test msg \r");
here 9845xxxxxx ru use xxxxx or any number
use number
Fri Jan 14 2011, 11:43 pm
that is wrong majoka.. it will not work that way...
ctrl-z should be sent after data only not command.
ctrl-z should be sent after data only not command.
Sat Jan 15 2011, 10:02 am
@ Mojaka
9845xxxxx is a data(mob no.)
After this msg along with ctrl+z has to be sent. then only msg will be sent.
@ Ajay,
Just a small delay i m giving.
I think in SMSString(" This is the test msg\r");
\r should not be used.
9845xxxxx is a data(mob no.)
After this msg along with ctrl+z has to be sent. then only msg will be sent.
@ Ajay,
Just a small delay i m giving.
void delay(unsigned int i) { unsigned int k, l; for(k=0;k<i;k++) for(l=0;l<1000;l++); }
I think in SMSString(" This is the test msg\r");
\r should not be used.
majoka like this.
Fri Jul 15 2011, 09:45 am
Hi
I want to store the msg content(i.e msg, mob no, date/time) into the eeprom(24C256-256K). the below code works fine for 24C04/02 chips but didnt worked for
24C256. Is there is any addressing different from 24C04?
I want to store the msg content(i.e msg, mob no, date/time) into the eeprom(24C256-256K). the below code works fine for 24C04/02 chips but didnt worked for
24C256. Is there is any addressing different from 24C04?
void main() { unsigned char i[16],l,k; unsigned char c[16]; lcd_ini(); k=0x60;// Ascii values storing in array for(l=0;l<=15;l++) { c[l]=k; k++; } c[l]='\0'; //writing that array into eeprom write_string_eprom(0x00,c);//starting addr, array[] lcd_command(0x80); //read the stored data for(l=0;l<=15;l++) { i[l]=read_e2prom(0xA0,l);// device addr, starting addr. aknowledge(); lcd_data(i[l]);// display same on LCD } while(1); } void write_string_eprom(unsigned char addr, unsigned char *text) { while(*text) { write_e2prom(0xA0,addr,*text++); addr++; } } void write_e2prom(unsigned char device_id,unsigned char location,unsigned char c) { do { start(); //starts i2c bus send_byte(device_id); //select slave device aknowledge(); if(slave_ack==1) //if acknowledge not received, stop i2c bus stop(); }while(slave_ack==1); //loop until acknowledge is received send_byte(location); //send address location aknowledge(); send_byte(c); //send data to i2c bus aknowledge(); stop(); //stop i2c bus delay(1); } //reads one byte of data(c) from slave device(device_id) at given address(location) unsigned char read_e2prom(unsigned char device_id,unsigned char location) { unsigned char c; do { start(); //starts i2c bus send_byte(device_id); //select slave device aknowledge(); if(slave_ack==1) //if acknowledge not received, stop i2c bus stop(); }while(slave_ack==1); //loop until acknowledge is received send_byte(location); //send address location aknowledge(); stop(); //stop i2c bus start(); //starts i2c bus send_byte(device_id+1); //select slave device in read mode aknowledge(); c=read_byte(); //receive data from i2c bus aknowledge(); stop(); //stop i2c bus return c; }
Powered by e107 Forum System