Wednesday, 25 July 2012
Example coding to know the response from GSM Modem.
#include <pic.h>
#use delay (clock=20000000)
#fuses hs,nolvp,nowdt,noprotect,nobrownout
#use rs232(baud=9600, bits=8, xmit=pin_C6, rcv=pin_C7, parity=n, stream=GSM)
#byte porta=5
#byte portb=6
#byte portc=7
#include "flex_lcd.c"
volatile int counter_search=0; //counter to traverse the array
volatile int counter_read=0; //counter to fill the array
volatile Char Recieve_String[70]; //buffer for incoming data
int GET_OK(int Stop_Search); // Just searches for an OK.
int TEST_AT();
void main()
{
set_tris_a( 0x00 ); // to avoid floating pins
set_tris_b( 0x00 );
output_b(0X00);
set_tris_c( 0x80 );
enable_interrupts(INT_RDA); // enable RDA interrupts
enable_interrupts(GLOBAL); // enable global ints
delay_ms(500);
lcd_init();
lcd_gotoxy(3,1);
lcd_putc("GET RESPONSE");
delay_ms(1000);
delay_ms(1000);
TEST_AT();
}
int TEST_AT()
{
counter_read=0;
lcd_gotoxy(8,2);
lcd_putc("AT");
printf("AT\n\r"); //send command
While(counter_read<=8) //"A T \R \R \N O K \R \N" characters returned by modem
{
}
counter_read=0;
Delay_ms(500);
if(GET_OK(0X0A))
{ lcd_gotoxy(8,2);
lcd_putc("OK");
return(1); }
else return(0);
}
int GET_OK(Stop_Search)
{
counter_search=0;
while((Recieve_String[counter_search]!='O')&&(counter_search<Stop_Search))
{
counter_search++; //obvious
}
if((Recieve_String[counter_search]=='O')&&(Recieve_String[counter_search+1]=='K'))
{
counter_search=0;
return(1);
}
return(0);
counter_search=0;
}
#int_RDA
void RDA_isr()
{
Recieve_String[counter_read]=getchar(GSM);
counter_read++;
if(counter_read==69)
counter_read=0;
}
Wednesday, 18 July 2012
9am - 1 pm
Continue with GSM modem.
Sending SMS
Continue with GSM modem.
Sending SMS
Flow of AT command that must be use to communicate with the GSM modem (between GSM and PIC).
AT+CMGF= 1 ---> set PDU Mode = 1, Text Mode = 0
Enter : \n\r
Example coding : printf ("AT+...")
putc (26)
putc (0x14) <---- value of 14 is from ASCII Table
![]() |
| Sent SMS using AT Command from Hyper Terminal |
2pm - 5pm
Mr. Mazran give me another task to construct basic circuit of instrumentation amplifier 1NA114 in breadboard by follow the value that he need.
Component: Variable resistor: 10k Ohm, 50k Ohm, resistor: 2.2k Ohm (4 unit), Supply: adapter
12V, 1NA114 amplifier
Circuit that have been constructed:
Tuesday, 17 July 2012
Continue with GSM task. Try solve problem how to get GSM receive our coding and the function "CALL READY" also not interframe. Other thing that Mr. Mazran told us which try use interrupt function.
UART
UART is stand for Universal Asynchronous Receiver Transmitter. UART signal is use to send and receive data over the three wires, which is TX, RX and GND. Synchronous transmission requires the sender and receiver to share the same clock signal. While the Synchronous transmission allow the data is sent without a clock signal sent but the sending and receiver must to operate at the same timing parameter known as Baud Rate.
Subscribe to:
Posts (Atom)




