code.txt - Program to interface GSM Module with 8051...

This preview shows page 1 - 3 out of 3 pages.

// Program to interface GSM Module with 8051 microcontroller (AT89C51) using PC and LCD #include<reg51.h> #define port P1 #define dataport P2 // Data port for LCD sbit rs = port^0; sbit rw = port^1; sbit en = port^2; int count,i; unsigned char check,str[15]; bit check_space ; void init_serial() // Initialize serial port { TMOD=0x20; // Mode=2 TH1=0xfd; // 9600 baud SCON=0x50; // Serial mode=1, 8-Bit data, 1 Stop bit, 1 Start bit, Receiving on TR1=1; // Start timer } void delay(unsigned int msec ) // Function for delay { int i,j ; for(i=0;i<msec;i++) for(j=0; j<1275; j++); } void lcd_cmd(unsigned char item) // Function to send command on LCD { dataport = item; rs= 0; rw=0; en=1; delay(1); en=0; return; } void lcd_data(unsigned char item) // Function to display character on LCD { dataport = item; rs= 1; rw=0; en=1; delay(1); en=0; return; } void lcd_data_string(unsigned char *str) // Function to display string on LCD { int i=0; while(str[i]!='\0') { lcd_data(str[i]); i++; delay(10); } return; }
Image of page 1

Subscribe to view the full document.

void lcd() { lcd_cmd(0x38); // For using 8-bit 2 row LCD delay(5); lcd_cmd(0x0F); // For display on, cursor blinking delay(5); lcd_cmd(0x80);
Image of page 2
Image of page 3
  • Winter '18
  • ASCII, Carriage return, Serial communication, Serial port, Newline, Programming For Microcontrller

{[ snackBarMessage ]}

Get FREE access by uploading your study materials

Upload your study materials now and get free access to over 25 million documents.

Upload now for FREE access Or pay now for instant access
Christopher Reinemann
"Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

Ask a question for free

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern