hoperain
Newbie level 1
we used the code written below to interface SIM300 with LPC2148. we are able to send text messages using hyperterminal. We are even able to see the processor sending the AT commands in the terminal of Flash magic (we are using keil for simulation and flash magic for flashing the code) WE have 9600 as the baudrate. Though the processpr and the SIM300 work individually well when clubbed together we are unable to receive the text.
Can you suggest where we could be going wrong
*the code ?
*Something woth the hardware which we might have overlooked?
(we connect the gsm module to the processor using female to female rs232 connector)
Can you suggest where we could be going wrong
*the code ?
*Something woth the hardware which we might have overlooked?
(we connect the gsm module to the processor using female to female rs232 connector)
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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 #include <LPC21xx.H> char at_command[]="AT\nn", mode[]="AT+CMGF=1n", msg_test[]="AT+CMGS=?n", command_phone[]="AT+CMGS=\"12345678\"n", msg[]="Hellon"; char out; char in; void set_uart() { PINSEL0= 0X50005; U0LCR= 0X83; U0DLL= 97; U0LCR=0X03; U0LCR= 0X83; U0DLL= 97; U0LCR=0X03; return; } void charout() { while(!(U0LSR & 0X020)); U0THR = out; return; } void my_delay() { int i; for(i=0 ; i<10000; i++); return; } void main() { int i=0; set_uart(); IODIR1= 0XFF0000; IOSET1= 0X00000000; out=at_command[i++]; while(!(out=='n')) { charout(); my_delay(); out=at_command[i++]; } i=0; // enter= 0x0d, 0x0a out=0x0d; charout(); my_delay(); out=0x0a; charout(); my_delay(); IOSET1= 0X00FF0000; // AT+CMGF=1 out=mode[i++]; while(!(out=='n')) { charout(); my_delay(); out=mode[i++]; } i=0; out=0x0d; charout(); my_delay(); out=0x0a; charout(); my_delay(); IOSET1= 0X00000000; out=msg_test[i++]; while(!(out=='n')) { charout(); my_delay(); out=msg_test[i++]; } i=0; out=0x0d; charout(); my_delay(); out=0x0a; charout(); my_delay(); IOSET1= 0X00FF0000; out=command_phone[i++]; while(!(out=='n')) { charout(); my_delay(); out=command_phone[i++]; } i=0; out=0x0d; charout(); my_delay(); out=0x0a; charout(); my_delay(); out=msg[i++]; while(!(out=='n')) { charout(); my_delay(); out=msg[i++]; } i=0; out=0x0d; charout(); my_delay(); out=0x0a; charout(); my_delay(); out= 0x1a; // ctrl+z my_delay(); }