CLICK HERE FOR FREE BLOGGER TEMPLATES, LINK BUTTONS AND MORE! »

Thursday - 2 August 2012

Read SMS Using AT Commands (AT+CMGR, AT+CMGL)

The +CMGL AT command can be used to read all SMS messages stored in the message storage area. To list all SMS in message storage, the command line should be:
List All SMS from SIM to Hyper Terminal

Here are the message details that can be retrieved by the +CMGL AT command in SMS text mode from Hyper Terminal:-

+CMGL: <index>,<stat>,<oa/da>,[<alpha>],[<scts>][,<tooa/toda>,<length>]<CR><LF><data>[<CR><LF>

  • The index specifying the location of the SMS message in the message storage area.
  • Status of the SMS message ("received unread", "received read", "stored unsent", "stored sent", etc).
  • Originator/recipient phone number stored in the SMS message header and the type of the phone number.
  • Text associated to the originator/recipient phone number in the phonebook.
  • Time and date at which the SMS message arrived at the SMSC (available to incoming SMS messages only).
  • Body of the SMS message and its length.

Wednesday - 1 August 2012

Today, my group start to doing receive SMS on GSM Modem. This is some of coding that useful to receive SMS on GSM modem.

AT command
Meaning
+CNMI
New message indications
+CMGL
List messages
+CMGR
Read messages
+CNMA
New message acknowledgement

Delete SMS from Message Storage (AT+CMGD)

The AT command +CMGD (command name in text: Delete Message) is used to delete SMS message(s) from message storage. The message storage area from which SMS messages are deleted is specified by the +CPMS AT command (command name in text: Preferred Message Storage).

AT+CMGD=index[,flag]

The SMS specification has defined these flag values: 0, 1, 2, 3 and 4.

  • 0. Meaning: Delete only the SMS message stored at the location index from the message storage area. This is the default value.
  • 1. Meaning: Ignore the value of index and delete all SMS messages whose status is "received read" from the message storage area.
  • 2. Meaning: Ignore the value of index and delete all SMS messages whose status is "received read" or "stored sent" from the message storage area.
  • 3. Meaning: Ignore the value of index and delete all SMS messages whose status is "received read", "stored unsent" or "stored sent" from the message storage area.
  • 4. Meaning: Ignore the value of index and delete all SMS messages from the message storage area
Delete SMS on SIM using AT Command


Tuesday - 31 July 2012

Continue task on sending SMS from GSM Modem. This is the simple program code to sending GSM modem. GSM doesn't response anything before because MAX232 IC was damaged. Today, i try the simple program code to ensure that the GSM modem is OK.


#include <pic.h>
#fuses hs, nowdt, noprotect, nobrownout
#use delay(clock=20000000)
#use rs232(baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7, bits=8, stream=GSM)

#int_rda
void serial_isr()
{
   char c;
   c=fgetc(GSM);
}

void main()
{
    enable_interrupts(INT_RDA);
    enable_interrupts(GLOBAL);
   
    fprintf(GSM, "AT\n\r");
    delay_ms(15000);
    fprintf(GSM, "AT+CMGF=1\n\r");
    delay_ms(3000);
    fprintf(GSM, "AT+CMGS=\"+6**********\"\n\r");
    delay_ms(3000);
    fprintf(GSM, "hello FROM mcu");
    putc(26);
}

Monday - 30 July 2012


Serial Communication trough RS232 cable

Simple program code for Serial Communication

#include <pic.h>
#use delay(clock=20000000)
#fuses hs, nowdt, nolvp, noprotect
#use rs232(baud=9600,xmit=pin_c6,rcv=pin_c7, parity=n)

int mystatus=0; //here can't declare byte coz not detected by compiler
char mydata;

void main()
{
int count=0;

set_tris_c(0b10001000); //here c6 must be 0, c7 must be 1 (input)
printf("Enter your character : A or S or Z or X");

while(true)
{
if(kbhit()) //monitor incoming charactor from RS232
{
   mydata=toupper(getch()); //receive charactor dan save in mydata
   printf("\n\rYou entered: %c",mydata); //display on hyper terminal
   count++;
   mystatus=1;
}
if (mystatus==1)
{
if(mydata=='A')
{
    output_high(pin_c4); //led on
}
if (mydata=='S')
{
    output_low(pin_c4); //led off
}
if (mydata=='Z')
{
    output_high(pin_c1); //buzzer on
}
if (mydata=='X')
{
    output_low(pin_c1);  //buzzer off
}
mystatus=0;
}//end if
}//end while
}//end void main

Explanation for Example Program Code Above

  • Kbhit ()
Kbhit () is use to check or monitor the incoming character from hardware RS232. When a key is pressed, this function will returns to true or non-zero. When nothings pressed, kbhit () will returns false or zero.

  • Toupper ()
Toupper () is special function to convert input lowercase letter to uppercase letter. If the input data is ‘a’ so that the toupper () will convert the character to uppercase ‘A’.

  • Getch ()
Getch () is returns an 8-bit character. This function is to gets a single-byte (8-bit) character from the terminal. This functions only allow a single character as an input from hardware RS232 to the PIC 16F877A.

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;
}

Tuesday, 24 July 2012

find info I to V converter dgn btol kn cct connection

Monday, 23 July 2012

btol kn cct in ares..tmbah voltage regulator

Friday, 20 July 2012

construct cct at ares..

Thursday, 19 July 2012

....

Wednesday, 18 July 2012

9am - 1 pm
     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.

Monday, 16 July 2012

     Still continue with GSM task. Today I try to understand the function of GSM modem because the task required to send SMS. There have been problem with the programming. We don't understand why no output from GSM modem when send AT command. 


GSM modem
source information: rps.bmi.edu.my/fyp/submission/S111/Degree/51210109211/uploads/51210109211.pdf

Friday, 13 July 2012

     Today I learned how to built RS232 data interface cable by using wire communication of black (pin 5), yellow (pin 2) and white (pin 3). Only connection for pin 2, 3 and 5 do for this task, the connection refer in figure below:  


Sub-D 9 pin

                    Sub-D 9  pin diagram                                            Sub-D 9 pin table

    This cable will connect to PIC board where 5V logic level receive and transmit signals of the PIC are connected to RS232 levels by a MAX232 device. Baud rates are generates by dividing down the system clock. The USART ( Universal Synchronous Asynchronous Receiver Transmitter) receive and transmit pins are C7 and C6 respectively.

Concept of receive and transmit

Tools required: wire communication (black, white, yellow), solder iron, solder lead, wire crimper, wire stripper, sub-D 9 pin male, pin header connector, shrink tube.

 
Wire stripper                                     Wire crimper

RS232 data interface cable

After that, do some research and any information about programming for new task which to set the PIC to send SMS in each 10 minutes. In 10 minute concept already but to set the programming for GSM modem still have problem.

Wednesday, 11 July 2012

     Continue our with sonar sensor task, there still some problem with the program code. Make some correction by create function declaration of beeping and beepoff for buzzer sound. As beeping and beepoff on the coding that has high and low pin C1 for buzzer. 


     Mr Mazran help us by give some hint:
#define DEL500 500 // declare of DEL500 as delay 500


void beeping (int dly) // function declaration of buzzer
{
output_high (pin_c1); // int dly : replace dly by the value at above coding
delay_ms (dly);
output_low (pin_c1);
delay_ms (dly);
}


     By afternoon, we complete our second task for understanding sonar sensor and output buzzer with 5 level. 
Connection circuit board

LCD display


     After done, Mr Mazran give another task by adding timer on the coding. The timer require need to be set at the PIC to send SMS in each 10 minute. We need to study and understand the flow by refer to CCS website and another forum. 

Tuesday, 10 July 2012

10am - 5pm
     Continue our second task of sonar sensor using PIC16F876A. Today we still try to create and discuss our programming and test in the ISIS simulation and also hardware. There have a problem to identify their range to display and also their beeping. At the same time, continue for my first task of soldering PCB board.


Step for Second Task


1.  Write C program by using PIC C Compiler software to create file.hex
2.  Simulate by using ISIS Proteus software:


3.  Write program into PIC by using PICkit 2 Programmer:
     Step 1: Open PICkit 2 Programmer
     Step 2: Check connection between PIC board and RS232 cable. Click Tools > Check Communication



     Step 3: Click File > Import File. Select file.hex program that have been create.
     Step 4: Click Write - to write the file.hex program


4.  Test hardware.
5.  Troubleshoot if have any error, then follow the involved step above. 

Monday, 9 July 2012


10am - 5pm

     Starting with our second task to create a PIC program code for the application of sonar sensor using PIC16F876A. Firstly, we discuss and understand the concept of our task which the sonar sensor as analog input device and buzzer as output device. The task require programming which the sonar sensor will sense the distance between sensor and any obstacle, at the same time the output buzzer will beep as warning sign. If the distance between sensor and obstacle is closer, the beep sound will be more quickly or the frequency of sound will increasing. As the LCD will display the range of the distance. This application same as reverse car concept.

Sonar sensor as input device

Buzzer as output device

PIC16F876A PCB board

     After compile program code into hex file, the programming is check after create simulation circuit in the ISIS Proteus software. For today, we try to understand how sonar sensor can sense the distance between sensor and obstacle by adjusted variable resistor. Then in the program code, the distance is divided into 5 level. 

Simulation using ISIS Proteus software

Friday - 6 July 2012


     Mr. Mazran and Engr. Siva briefing about rule and time attendance to follow during this industrial training:


Time:    9am   - 10am (Report blog)
            10am - 12.30pm (Daily chores)
            1pm   - 2pm (Break)
            5pm (Dismissed) 


Schedule:

General Task:
1. PCB / Soldering
2. PLC
3. IP Camera
4. Mechanical Prototype
5. Visual Basic (VB) : Week 5

Specific Task: Website Team

Thursday, 5 July 2012


     First of all i would like to introduce myself, my name is Nur Sakinah bt Abdul Razak. I'm practical student from UTeM. This blog is created to publish my daily report blog as practical student at HIIS.

Hitech Integrated Innovation Solutions Sdn. Bhd. 


HIIS is Hitech Integrated Innovation Solutions Sdn. Bhd. or known as UTeM Holdings. HIIS was constituted in January 2012 which organized by Mr. Mazran b. Esro, Engr. Siva Kumar Subramaniam and Prof Razi. HIIS currently come out with water level controller project. Since today, the projects had been installed at Wisma Persekutuan MITC, Ayer Keroh.

              
Mazran b. Esro                                 Engr. Siva Kumar 
                                                           Subramaniam      

     Today is my first day as practical student at HIIS. I and other team member is stationed at tutorial room in building FKEKK at main campus UTeM. The tutorial room use to complete the our industrial training activity such as report blog and daily chores (soldering, task, etc.). At first day, we prepared and clean tutorial room.

Location LI