zeckrey J
Newbie level 5
- Joined
- Apr 19, 2011
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- KENINGAU, SABAH
- Activity points
- 1,352
problem, i cannot receive the data in rx, the rcreg show me a junk data each time at+cmgr is entered, i try to show the message on lcd, but some times other come out, such as other memory, like at+cmgr that i stored in atcmd2..
please take a look at my coding and tell me where i did wrong...
please take a look at my coding and tell me where i did wrong...
PHP:
int CMGR()
{
unsigned char recv;
//recv=&msg;
for(i=0; i<=8; i++)
UART1_write(atcmd2[i]); // write the at+cmgr=2
UART1_write(0x0D); // send cr
delay_ms(10); //delay10ms
if(uart1_data_ready()==1) //only excute tis part if data is ready to receive
{
recv=uart1_read(); //read the data receive and stored in recv
uart1_write(recv); // send back data
Lcd_Init(); //initial lcd
Lcd_Cmd(_LCD_CLEAR); //clear lcd
Lcd_Cmd(_LCD_CURSOR_OFF); //no cursor
Lcd_Out(1,1,recv); //display stored msg
Delay_ms(2000); //delay 2000ms
}
}