Hi all... I have a very small issue.... i have written a code to send messages through SIM800 using SST89E516RD2 microcontroller. code is:-
#include <sst89e516rd2.h> sbit row0=P2^4; sbit row1=P2^5; sbit row2=P2^6; sbit row3=P2^7; sfr COL=0xA0; unsigned char *message = "Hi Everybody "; // Content of the message to be sent int keypad(); void sendsms(); void puts(unsigned char* ptr); void putc(unsigned char chr); void initialize(); unsigned char CTRLZ = 0x1A; unsigned char xdata phoneno[10]; //Array to store the phone no. void main() // MAIN STARTS HERE { unsigned int i,j; while(1) { for(j=0;j<10;j++) { phoneno[i]=keypad(); // Entering new company phone no LCD_putc(phoneno[i]); i++; } i=0; initialize(); msdelay(1000); sendsms(); } } void sendsms() { puts("ATE0\r"); msdelay(1000); puts("AT\r"); msdelay(1000); puts("AT+CMGF=1\r"); msdelay(1000); puts("AT+CMGS=\""); puts(phoneno); puts("\""); puts("\r"); msdelay(1000); puts(message); msdelay(1000); putc(CTRLZ); } int keypad() { unsigned char dat[4][4]={'1','2','3','A', // assigning key matrix '4','5','6','B', '7','8','9','-', '*','0','#','+', }; unsigned char colloc,rowloc; COL=0xFF; row0=0; row1=0; row2=0; row3=0; while(1) do { row0=0; row1=0; row2=0; row3=0; colloc=COL; colloc&=0x0F; } while(colloc!=0x0F); do { do { msdelay(10); colloc=COL; colloc&=0x0F; } while(colloc==0x0F); msdelay(10); colloc=COL; colloc&=0x0F; } while(colloc==0x0F); while(1) { row0=0; row1=1; row2=1; row3=1; msdelay(5); colloc=COL; colloc&=0x0F; if(colloc!=0x0F) { rowloc=0; break; } row0=1; row1=0; row2=1; row3=1; msdelay(5); colloc=COL; colloc&=0x0F; if(colloc!=0x0F) { rowloc=1; break; } row0=1; row1=1; row2=0; row3=1; msdelay(5); colloc=COL; colloc&=0x0F; if(colloc!=0x0F) { rowloc=2; break; } row0=1; row1=1; row2=1; row3=0; msdelay(5); colloc=COL; colloc&=0x0F; if(colloc!=0x0F) { rowloc=3; break; } } if(colloc==0x0E) return(dat[rowloc][0]); else if(colloc==0x0D) return(dat[rowloc][1]); else if(colloc==0x0B) return(dat[rowloc][2]); else return(dat[rowloc][3]); } } void puts(char* p) { char *temp = p; /*temp pointer so that the actual pointer is not displaced */ while(*temp != 0x00) { putc(*temp); temp++; } } void putc(unsigned char chr) { SBUF = chr; while(TI==0); /*Wait until the character is completely sent */ TI=0; /*Reset the flag */ } // MAIN ENDS HERE void initialize() { SCON = 0x50; /*SCON: mode 1, 8-bit UART, enable receive */ TMOD |= 0x20; /*TMOD: timer 1, mode 2, 8-bit */ TH1 = 0xFD; /*TH1: for 9600 baud */ TR1 = 1; /*TR1: timer 1 run */ } void msdelay(unsigned int value) { unsigned int i,j; for(i=0;i<value;i++) for(j=0;j<100;j++); }
Now my problem is when i change unsigned char Xdata phone[10]; to unsigned char phoneno[10]; i GSM module send me the messages... but if i write unsigned char Xdata phoneno[10]; the GSM modem does not send any messages. the system only works and sends messages when array phoneno[10] is stores in DATA instead of XDATA. why does this happen.... can you please help me....
I am not using any external xdata. The controller i am using has an internal xdata memory. I am using the same.
Yes, the processor has internal XDATA - but is it configured to use this RAM? There is a configuration register where one bit decides if XDATA accesses will use this internal RAM or if it will perform external accesses.
But how can i canfigure that.... Any notes for that...????
"But how can i canfigure that...."
Are you saying that the chip manufacturer hasn't documented the configuration registers for the processor???