EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
You are here: Home / Topics / please help me embedded c code

please help me embedded c code

|

Projects › Projects › please help me embedded c code

  • This topic has 1 reply, 2 voices, and was last updated 5 years, 10 months ago by Ashutosh Bhatt.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • September 24, 2016 at 4:15 pm #4560
    nallapu venkatesh
    Participant
      
    Can you please write code for in the header files #include "UART.h"
    #include "uart1.h"
     
    This is my project code ( not completly) 
     
    /**************************  HEADDER FILES ************************************/
    #include <LPC214X.H>
    #include "lcd.h"
    #include "UART.h"
    #include "uart1.h"
    #include <string.h>
    /************************** PIN CONNECTIONS ***********************************/
    #define photodiode (1<<16) //P0.16
    #define proximity  (1<<17)
    #define buzzer     (1<<18)   // Buzzer declaration of pin no 18 of PORT0
    #define motor      (1<<19)
    #define key        (1<<20)
    #define d1        (1<<21)
    #define d2        (1<<22)
    /************** PIN DECLARATIONS ****************/
    #define inc (1<<22) //P1.22
    #define dec (1<<23)
    #define ent (1<<24)
     
    unsigned char c[20],a[5],i,f1,f2;
    unsigned char d[50],j,fg1,fg2;
    unsigned char m,n,ti[10],lt[15],lg[15];
    unsigned char flag,f,x,b[20],k,numr[15],loc,z;
    /* KEY PAD SCAN FUNCTION*/
    unsigned char   keyscan(unsigned char loc)
    {
    unsigned char temp=0; 
    while((IOPIN1 & 0x01000000)!=0x00)
    {
    if((IOPIN1 & 0x00400000)==0x00)
    {
    delay(1000);
    while((IOPIN1 & 0x00400000)==0x00);
    delay(10);
    if(temp>=9)
    {
    temp=9;
    }
    else
    {
    temp++;
    }
    }
    if((IOPIN1 & 0x00800000)==0x00)
    {
    delay(1000);
    while((IOPIN1 & 0x00800000)==0x00);
    delay(10);
    if(temp<=0)
    {
    temp=0;
    }
    else      
    {
    temp–;
    }
    }
    lcdcmd(loc);
    lcddata(temp+0x30);
    }
    delay(1000);
    while((IOPIN1 & 0x01000000)==0x00);
    delay(300);
    return temp;
    }  
    ///// **** GPS initilisation function ******
    void gpsint(void)
    {
    lcdclear();
    if(d[0]=='G' && d[1]=='P' && d[2]=='G' && d[3]=='G' && d[4]=='A' )
    {
    disp_loc(0x80,"GPS CONNECTED ");
    lcdclear();
    disp_loc(0x80,"LT:");
    lcdcmd(0x83);
    loc=17;
    for(n=0;loc<26;n++)
    {
    lcddata(lt[n]=d[loc++]);      
    }
    lt[10]='N';
    lt[11]='';
    disp_loc(0xc0,"LG:");
    lcdcmd(0xC3);
    loc=29;
    for(n=0;loc<40;n++)
    {
    lcddata(lg[n]=d[loc++]);      
    }
    lt[12]='E';
    lg[13]='';
    delay(5000);
    }
    /************************** MAIN FUNCTION *************************************/
    int main( void )
    {
    unsigned int mask1,mask2,count,chk_flag;
    /************ LCDINTILISATIONS *****************/
    lcdint();
    disp_loc(0x80,"  WELCOME TO  ");
    disp_loc(0xc0,"  THE PROJECT ");
     
    serialint1();
     
    serialint0();
     
    gpsint();
    lcdclear();
    disp_loc(0x80,"  WELCOME TO  ");
    disp_loc(0xc0,"  THE PROJECT ");
    while(1)
    {
    mask1=IOPIN0 & 0x00010000; //photodiode
    mask2=IOPIN0 & 0x00020000; //proximity
    if((mask1==0) &&(mask2==0))
    {
    msg1();
    lcdclear();
    disp_loc(0x80,"ENTER PASSWORD");
    p1: delay(100);
    a[0]=keyscan(0xc0)+0x30;
    a[1]=keyscan(0xc1)+0x30;
    a[2]=keyscan(0xc2)+0x30;
    a[3]='';
    delay(100);
    disp_loc(0x80,"PASSWORD ENTERED");
    delay(100);
    if(!(strcmp(a,"123")))
    {
    delay(200);
    lcdclear();
    disp_loc(0x80,"AUTHENTICATION");
    disp_loc(0xc0,"    SUCCEED   ");
    p3:delay(500);
    chk_flag=0;
    while(chk_flag==0)
    {
    if(IOPIN0 ==((IOPIN0 & 0xff0ffffff)|(0x00E00000)))
    {
    IOCLR0=motor;
    }
    else
    {
    IOSET0=motor;
    if(f2==1)
    {
    lcdcmd(0x01); // clear display on LCD
    lcdcmd(0x80);
    lcd_str("SMS recevied"); // display on lcd as SMS receivied
    lcdcmd(0x01);
    lcdcmd(0x80);
    lcd_str("NO:");
    lcd_str(numr);
    lcdcmd(0xc0);
    lcd_str(a);
    if(!strcmp(a,"BLOCKd"))
    {
    IOCLR0=motor;
    gpsint();
    lcdclear();
    disp_loc(0x80,"SENDING SMS…");
    serial1("AT+CMGS=");
    serial_char1(0x22);
    serial1("+918790072132");
    serial_char1(0x22);
    serial_char1(0x0d);
    delay(2000);
    serial1("VEHICLE IS BLOCKED IN THIS LOCATION");
    serial1("LT:");
    serial1(lt);
    serial1("LG:");
    serial1(lg);
    serial_char1(0x1A);
    disp_loc(0x80,"SENDING SENDED…");
    delay(10000); 
    while(1);
    }
    if(!strcmp(a,"TRACK"))
    {
    gpsint();
    lcdclear();
    disp_loc(0x80,"SENDING SMS…");
    serial1("AT+CMGS=");
    serial_char1(0x22);
    serial1("+918790072132");
    serial_char1(0x22);
    serial_char1(0x0d);
    delay(2000);
    serial1("VEHICLE IS IN THIS LOCATION");
    serial1("LT:");
    serial1(lt);
    serial1("LG:");
    serial1(lg);
    serial_char1(0x1A);
    disp_loc(0x80,"SENDING SENDED…");
    delay(10000);   
    }
    }
    }
    mask1=IOPIN0 & 0x00010000; //photodiode
    mask2=IOPIN0 & 0x00020000; //proximity
    if((mask1!=0) &&(mask2!=0))
    {
    chk_flag=1;
    }
    }
    lcdclear();
    IOCLR0=motor;
    disp_loc(0x80,"  WELCOME TO  ");
    disp_loc(0xc0,"  THE PROJECT ");
    }
    else
    {
    count++;
    IOSET0=buzzer;
    disp_loc(0xc0,"WRONG  PASSWORD");
    delay(500);
    IOCLR0=buzzer;
    if(count>=3)
    {
    count=0;
    lcdclear();
    delay(3000);
    gpsint();
    lcdclear();
    disp_loc(0x80,"SENDING SMS…");
    serial1("AT+CMGS=");
    serial_char1(0x22);
    serial1("+918790072132");
    serial_char1(0x22);
    serial_char1(0x0d);
    delay(2000);
    serial1("VEHICLE IS GOING TO BE THEFTED, IS AT LOCATION");
    serial1("LT:");
    serial1(lt);
    serial1("LG:");
    serial1(lg);
    serial_char1(0x1A);
    disp_loc(0x80,"SENDING SENDED…");
    delay(10000);   
    lcdclear();
    disp_loc(0x80,"  THE VEHICLE  ");
    disp_loc(0xc0,"  ACESS DENIED ");
    delay(5000);
    lcdcmd(0x01);
    disp_loc(0x80," DOOR LOCKED ");
    IOSET0=d2;IOCLR0=d1;
    delay(5000);
    IOCLR0=d1;IOCLR0=d2;
    delay(50000);
    lcdclear();
    disp_loc(0x80,"  ENTER SECRETE ");
    p2:disp_loc(0xc0," KEY:");
    delay(100);
    a[0]=keyscan(0xc5)+0x30;
    a[1]=keyscan(0xc6)+0x30;
    a[2]=keyscan(0xc7)+0x30;
    a[3]='';
    delay(100);
    if(!(strcmp(a,"456")))
    {
    delay(200);
    lcdclear();
    disp_loc(0x80,"AUTHENTICATION");
    disp_loc(0xc0,"    SUCCEED   ");
    delay(50000);
    lcdcmd(0x01);
    disp_loc(0x80," DOOR OPEN  ");
    IOSET0=d1;IOCLR0=d2;
    delay(5000);
    IOCLR0=d1;IOCLR0=d2;
    delay(50000);
    IOSET0=d2;IOCLR0=d1;
    delay(5000);
    IOCLR0=d1;IOCLR0=d2;
    }
    else
    {
    IOSET0=buzzer;
    lcdclear();
    disp_loc(0x80,"REENTER SECRETE ");
    delay(100);
    IOCLR0=buzzer;
    goto p2;
    }
    }
    else
    {
    lcdclear();
    disp_loc(0x80,"REENTER PASSWORD");
    goto  p1;
    }
    }
    if(f2==1)
    {
    lcdcmd(0x01); // clear display on LCD
    lcdcmd(0x80);
    lcd_str("SMS recevied"); // display on lcd as SMS receivied
    lcdcmd(0x01);
    lcdcmd(0x80);
    lcd_str("NO:");
    lcd_str(numr);// display of mobile no
    lcdcmd(0xc0);
    lcd_str(a);
    if(!strcmp(a,"BLOCKd"))
    {
    IOCLR0=motor;
    gpsint();
    lcdclear();
    disp_loc(0x80,"SENDING SMS…");
    serial1("AT+CMGS=");
    serial_char1(0x22);
    serial1("+918790072132");
    serial_char1(0x22);
    serial_char1(0x0d);
    delay(2000);
    serial1("VEHICLE IS BLOCKED IN THIS LOCATION");
    serial1("LT:");
    serial1(lt);
    serial1("LG:");
    serial1(lg);
    serial_char1(0x1A);
    disp_loc(0x80,"SENDING SENDED…");
    delay(10000); 
    while(1);
    }
    if(!strcmp(a,"TRACK"))
    {
    gpsint();
    lcdclear();
    disp_loc(0x80,"SENDING SMS…");
    serial1("AT+CMGS=");
    serial_char1(0x22);
    serial1("+918790072132");
    serial_char1(0x22);
    serial_char1(0x0d);
    delay(2000);
    serial1("VEHICLE IS IN THIS LOCATION");
    serial1("LT:");
    serial1(lt);
    serial1("LG:");
    serial1(lg);
    serial_char1(0x1A);
    disp_loc(0x80,"SENDING SENDED…");
    delay(10000);   
    }
    }
    }
    }
    }
     
     
     
     
     
    September 26, 2016 at 8:29 am #14157
    Ashutosh Bhatt
    Participant

    these files must be given with source code. otherwise it does not have any use

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • How to power up two stereo audio amplifiers from a single source of power supply August 12, 2022
  • Nokia 5110 HW in Oshonsoft August 12, 2022
  • Drill speed controller fault August 12, 2022
  • Charging shutdown circuit question. August 12, 2022
  • My NE555 chips gone bad August 12, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools