+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Junior Member level 2
    Points: 298, Level: 3

    Join Date
    Nov 2016
    Posts
    22
    Helped
    0 / 0
    Points
    298
    Level
    3

    Problem of no characters displayed on 16x2 lcd on proteus 8 simulation

    Hello Guys any one who can help me on my problem that occurred on my project simulation on proteus 8.1 am using pic18f4620 microcontroller, my project based on SMS controlled street lights to turn them on and off as well as to provide feedbacks to the user mobile phone, am using SIM900A that i have interfaced it to the PC through TTL to USB converter, my project on simulation it operates very well by controlling only two leds but when i want to add more if statements inorder to control more than two leds no any characters get displayed on 16x2 LCD I don't understand what the problem is because on the compilation through Mikroc pro for PIC no errors on the code as well as on simulation on proteus but the problem is no any characters get displayed on 16x2 LCD as blocks of if statements increasing. please help me because it's my final year project and am going to submit soon as possible i'm assigned to control and monitor 8 street lights.

    see my attached screenshot of the project circuit below...Click image for larger version. 

Name:	mwanyamaki.PNG 
Views:	11 
Size:	47.4 KB 
ID:	136346

    •   AltAdvertisment

        
       

  2. #2
    Banned
    Points: 5,417, Level: 17

    Join Date
    Jun 2016
    Posts
    1,159
    Helped
    126 / 126
    Points
    5,417
    Level
    17

    Re: Problem of no characters displayed on 16x2 lcd on proteus 8 simulation

    Zip and post your project (Code) files including Proteus file.



    •   AltAdvertisment

        
       

  3. #3
    Junior Member level 2
    Points: 298, Level: 3

    Join Date
    Nov 2016
    Posts
    22
    Helped
    0 / 0
    Points
    298
    Level
    3

    Re: Problem of no characters displayed on 16x2 lcd on proteus 8 simulation

    OK Sir see the zip file below then please tell me what to do on that issue because i want to control 8 devices as you will see on the circuit, and in the code I have used if statements to make actions for all 8 devices when sms sent by user through his/her phone equal to the one on the if statement so please check it then give me the feedback what to do on that sir.



    •   AltAdvertisment

        
       

  4. #4
    Junior Member level 2
    Points: 298, Level: 3

    Join Date
    Nov 2016
    Posts
    22
    Helped
    0 / 0
    Points
    298
    Level
    3

    Re: Problem of no characters displayed on 16x2 lcd on proteus 8 simulation

    OK Sir see the code below and the proteus circuit as you have seen on the screenshot above, then please tell me what to do on that issue because i want to control 8 devices as you will see on the circuit, and in the code I have used if statements to make actions for all 8 devices when sms sent by user through his/her phone equal to the one on the if statement so please check it then give me the feedback what to do on that sir. Am using MikroC pro for PIC compiller



    Code:
    sbit LCD_RS at RC0_bit;
    sbit LCD_EN at RC1_bit;
    sbit LCD_D4 at RC2_bit;
    sbit LCD_D5 at RC3_bit;
    sbit LCD_D6 at RC4_bit;
    sbit LCD_D7 at RC5_bit;
    sbit LCD_RS_Direction at TRISC0_bit;
    sbit LCD_EN_Direction at TRISC1_bit;
    sbit LCD_D4_Direction at TRISC2_bit;
    sbit LCD_D5_Direction at TRISC3_bit;
    sbit LCD_D6_Direction at TRISC4_bit;
    sbit LCD_D7_Direction at TRISC5_bit;
    
    
    char IncData;
    int x =  0;
    char RcvdMsg[60] = "";
    int RcvdCheck = 0;
    int RcvdConf = 0;
    int index = 0;
    int RcvdEnd = 0;
    char MsgMob[15];
    char MsgTxt[20];
    int MsgLength = 0;
    
    void RecSMS();
    void ClearBuffers();
    void Config();
    
    void main() {
     lcd_init();
    Lcd_Cmd(_LCD_CLEAR);
      Lcd_Cmd(_LCD_CURSOR_OFF);
      Lcd_Out(1,2,"UNIVERSITY OF ");
      Lcd_Out(2,2,"DAR ES SALAAM");
      Delay_ms(5000);
      Lcd_Cmd(_LCD_CLEAR);
    
      Lcd_Out(1,2,"GSM BASED ON");
      Lcd_Out(2,2,"STREET LIGHTS");
      Delay_ms(5000);
      Lcd_Cmd(_LCD_CLEAR);
    
      Lcd_Out(1,2,"***WELCOME****");
      Lcd_Out(2,1,"WAITING FOR SMS");
      Delay_ms(5000);
      UART1_init(9600);
      Delay_ms(100);
    
       INTCON.GIE = 1;
       INTCON.PEIE = 1;
       PIE1.RCIE=1;
    
      TRISD=0X00;
      PORTD=0X00;
      TRISB = 1;
    
      Config();
    
      while(1)
      {      while(!UART1_Data_Ready());
              if (UART1_Data_Ready())
            {
              IncData = UART1_Read();
              //UART1_Write_Text(IncData);
              if(IncData == '+'){RcvdCheck = 1;}
              if((IncData == 'C') && (RcvdCheck == 1)){RcvdCheck = 2;}
              if((IncData == 'M') && (RcvdCheck == 2)){RcvdCheck = 3;}
              if((IncData == 'T') && (RcvdCheck == 3)){RcvdCheck = 4;}
              if(RcvdCheck == 4){index = 0;RcvdConf = 1; RcvdCheck = 0;}
    
              if(RcvdConf == 1)
              {
                  if(IncData == '\n')
                  {RcvdEnd++;}
                  if(RcvdEnd == 3)
                  {RcvdEnd = 0;}
                  RcvdMsg[index] = IncData;
    
                  index++;
                  if(RcvdEnd == 2)
                  {RcvdConf = 0;MsgLength = index-2;index = 0;}
                  if(RcvdConf == 0)
                  {
                      //PortD.F3 = 1;
                      UART1_Write_Text("MOBILE NO: ");
                      for(x = 4;x < 17;x++)
                      {
                          MsgMob[x-4] = RcvdMsg[x];
                          UART1_Write(MsgMob[x-4]);
                      }
                     UART1_Write(0x0D);
                     UART1_Write_Text("SMS Text: ");
                      for(x = 46;x < MsgLength;x++)
                      {
                          MsgTxt[x-46] = RcvdMsg[x];
                          UART1_Write(MsgTxt[x-46]);
                      }
    if((MsgTxt[0] == 'S')&&(MsgTxt[1] == 'T')&&(MsgTxt[2] == 'R')&&(MsgTxt[3] == 'T')&&(MsgTxt[4] == 'A')&&(MsgTxt[5] == 32)&&(MsgTxt[6] == 'L')&&(MsgTxt[7] == '1')&&(MsgTxt[8] == 32)&&(MsgTxt[9] == 'O')&&(MsgTxt[10] == 'N'))
    {
    PORTD.F0 = 1;
    Delay_ms(1000);
    UART1_Write_Text("AT+CMGD=1\r\n");
    Lcd_init();
    Lcd_Cmd(_LCD_CURSOR_OFF);
    LCD_Out(1,1,"STRTA L1 TURNED");
    LCD_Out(2,1,"ON SUCCESSFULLY");
    Delay_ms(4000);
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Out(1,3,"WAITING FOR ");
    Lcd_Out(2,1,"ANOTHER NEW SMS");
    UART1_Write_Text("AT+CMGS="+255717677776"\r");
    Delay_ms(500);
    UART1_Write_Text("STREET-A LIGHT 1 TURNED ON SUCCESSFULLY");
    UART1_Write(26);
    Delay_ms(1000);
    }//L1ON();}
    
    if((MsgTxt[0] == 'S')&&(MsgTxt[1] == 'T')&&(MsgTxt[2] == 'R')&&(MsgTxt[3] == 'T')&&(MsgTxt[4] == 'A')&&(MsgTxt[5] == 32)&&(MsgTxt[6] == 'L')&&(MsgTxt[7] == '1')&&(MsgTxt[8] == 32)&&(MsgTxt[9] == 'O')&&(MsgTxt[10] == 'F')&&(MsgTxt[11] == 'F'))
     {
    PORTD.F0 = 0;
    Delay_ms(1000);
    UART1_Write_Text("AT+CMGD=1\r\n");
    Lcd_init();
    Lcd_Cmd(_LCD_CURSOR_OFF);
    LCD_Out(1,1,"STRTA L1 TURNED");
    LCD_Out(2,1,"OFF SUCCESSFULLY");
    Delay_ms(4000);
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Out(1,3,"WAITING FOR ");
    Lcd_Out(2,1,"ANOTHER NEW SMS");
    UART1_Write_Text("AT+CMGS="+255717677776"\r");
    Delay_ms(500);
    UART1_Write_Text("STREET-A LIGHT 1 TURNED OFF SUCCESSFULLY");
    UART1_Write(26);
    Delay_ms(1000);
    }//L1OF();}
    
    if((MsgTxt[0] == 'S')&&(MsgTxt[1] == 'T')&&(MsgTxt[2] == 'R')&&(MsgTxt[3] == 'T')&&(MsgTxt[4] == 'A')&&(MsgTxt[5] == 32)&&(MsgTxt[6] == 'L')&&(MsgTxt[7] == '2')&&(MsgTxt[8] == 32)&&(MsgTxt[9] == 'O')&&(MsgTxt[10] == 'N'))
    {
    PORTD.F1 = 1;
    Delay_ms(1000);
    UART1_Write_Text("AT+CMGD=1\r\n");
    Lcd_init();
    Lcd_Cmd(_LCD_CURSOR_OFF);
    LCD_Out(1,1,"STRTA L2 TURNED");
    LCD_Out(2,1,"ON SUCCESSFULLY");
    Delay_ms(4000);
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Out(1,3,"WAITING FOR ");
    Lcd_Out(2,1,"ANOTHER NEW SMS");
    UART1_Write_Text("AT+CMGS="+255717677776"\r");
    Delay_ms(500);
    UART1_Write_Text("STREET-A LIGHT 2 TURNED ON SUCCESSFULLY");
    UART1_Write(26);
    Delay_ms(1000);
    }//L2ON();}
    
    if((MsgTxt[0] == 'S')&&(MsgTxt[1] == 'T')&&(MsgTxt[2] == 'R')&&(MsgTxt[3] == 'T')&&(MsgTxt[4] == 'A')&&(MsgTxt[5] == 32)&&(MsgTxt[6] == 'L')&&(MsgTxt[7] == '2')&&(MsgTxt[8] == 32)&&(MsgTxt[9] == 'O')&&(MsgTxt[10] == 'F')&&(MsgTxt[10] == 'F'))
    {
    PORTD.F1 = 0;
    Delay_ms(1000);
    UART1_Write_Text("AT+CMGD=1\r\n");
    Lcd_init();
    Lcd_Cmd(_LCD_CURSOR_OFF);
    LCD_Out(1,1,"STRTA L2 TURNED");
    LCD_Out(2,1,"OFF SUCCESSFULLY");
    Delay_ms(4000);
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Out(1,3,"WAITING FOR ");
    Lcd_Out(2,1,"ANOTHER NEW SMS");
    UART1_Write_Text("AT+CMGS="+255717677776"\r");
    Delay_ms(500);
    UART1_Write_Text("STREET-A LIGHT 2 TURNED OFF SUCCESSFULLY");
    UART1_Write(26);
    Delay_ms(1000);
    }//L2OF();}
    
    if((MsgTxt[0] == 'S')&&(MsgTxt[1] == 'T')&&(MsgTxt[2] == 'R')&&(MsgTxt[3] == 'T')&&(MsgTxt[4] == 'A')&&(MsgTxt[5] == 32)&&(MsgTxt[6] == 'L')&&(MsgTxt[7] == '3')&&(MsgTxt[8] == 32)&&(MsgTxt[9] == 'O')&&(MsgTxt[10] == 'N'))
    {
    PORTD.F2 = 1;
    Delay_ms(1000);
    UART1_Write_Text("AT+CMGD=1\r\n");
    Lcd_init();
    Lcd_Cmd(_LCD_CURSOR_OFF);
    LCD_Out(1,1,"STRTA L3 TURNED");
    LCD_Out(2,1,"ON SUCCESSFULLY");
    Delay_ms(4000);
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Out(1,3,"WAITING FOR ");
    Lcd_Out(2,1,"ANOTHER NEW SMS");
    UART1_Write_Text("AT+CMGS="+255717677776"\r");
    Delay_ms(500);
    UART1_Write_Text("STREET-A LIGHT 3 TURNED ON SUCCESSFULLY");
    UART1_Write(26);
    Delay_ms(1000);
    }//L2ON();}
    
    else if((MsgTxt[0] == 'S')&&(MsgTxt[1] == 'T')&&(MsgTxt[2] == 'R')&&(MsgTxt[3] == 'T')&&(MsgTxt[4] == 'A')&&(MsgTxt[5] == 32)&&(MsgTxt[6] == 'L')&&(MsgTxt[7] == '3')&&(MsgTxt[8] == 32)&&(MsgTxt[9] == 'O')&&(MsgTxt[10] == 'N'))
    {
    PORTD.F2 = 1;
    Delay_ms(1000);
    UART1_Write_Text("AT+CMGD=1\r\n");
    Lcd_init();
    Lcd_Cmd(_LCD_CURSOR_OFF);
    LCD_Out(1,1,"STRTA L3 TURNED");
    LCD_Out(2,1,"ON SUCCESSFULLY");
    Delay_ms(4000);
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Out(1,3,"WAITING FOR ");
    Lcd_Out(2,1,"ANOTHER NEW SMS");
    UART1_Write_Text("AT+CMGS="+255717677776"\r");
    Delay_ms(500);
    UART1_Write_Text("STREET-A LIGHT 3 TURNED ON SUCCESSFULLY");
    UART1_Write(26);
    Delay_ms(1000);
    }//L2ON();}
    
    
    
     ClearBuffers();
    
                  }
              }
         }
      }
    
    }
    
    
    
    void ClearBuffers()
    {
        strcpy(RcvdMsg,"");
        RcvdCheck = 0;
        RcvdConf = 0;
        index = 0;
        RcvdEnd = 0;
        strcpy(MsgMob,"");
        strcpy(MsgTxt,"");
        MsgLength = 0;
    }
    
    void Config()
    {
     Delay_ms(2000);
        UART1_Write_Text("ATE0\r\n");
        Delay_ms(1000);
        UART1_Write_Text("AT\r\n");
        Delay_ms(1000);
        UART1_Write_Text("AT+CMGF=1\r\n");
        Delay_ms(1000);
        UART1_Write_Text("AT+CNMI=1,2,0,0,0\r\n");
        Delay_ms(1000);
    }
    Last edited by KlausST; 21st February 2017 at 17:23. Reason: added code tags



  5. #5
    Junior Member level 2
    Points: 298, Level: 3

    Join Date
    Nov 2016
    Posts
    22
    Helped
    0 / 0
    Points
    298
    Level
    3

    Re: Problem of no characters displayed on 16x2 lcd on proteus 8 simulation

    PROJECT.zip

    See my attachment above then give me the feedback sir.



--[[ ]]--