pcbway

Circuit Designing of LCD with PIC on Proteus ISIS, LCD working code with PIC, LCD proteus circuit with PIC, LCD working in proteus

Hello friends, hope you all are fine and enjoying good health. Today I am posting the next part of Proteus tutorial which is Interfacing of LCD with PIC Microcontroller. . In the previous post of this tutorial, we have seen the basics of Proteus and discussed various functions of Proteus ISIS. If you are new to Proteus then I would recommend that before starting this tutorial, you should first read the first part so that you get the better idea of Proteus as I wont go in detail in today’s post. Today, we will first design a circuit of LCD with PIC on Proteus ISIS which includes PIC microcontroller and then we will see how to burn the microcontroller in Proteus and at the end we will run our circuit and will display some text on the LCD. It will be quite a fun so let’s start.

If anyone having any problem at any point, ask in comments and I will try my best to resolve them. So, let’s get started with Interfacing of LCD with PIC Microcontroller.

Circuit Designing in Proteus

  • First of all, open the Proteus ISIS software.
  • In the start, it will look exactly the same as in below image.
  • Now click on button P as shown in below figure.
Circuit Designing of LCD with PIC on Proteus ISIS, LCD working code with PIC, LCD proteus circuit with PIC, LCD working in proteus
  • When you click this button a new window will pop up as shown in below figure.
  • This is the place where we search our components, like as I want 7805 so I searched for this component and the Proteus has given me the related components.
  • Once you get your desired component, simply double click on it and it will be added in your database so that you can use them.
Circuit Designing of LCD with PIC on Proteus ISIS, LCD working code with PIC, LCD proteus circuit with PIC, LCD working in proteus
  • The below image shows the components which we are gonna use in this project, so simply search for all the components and then double click on them and finally you will get all the components as shown below:
Circuit Designing of LCD with PIC on Proteus ISIS, LCD working code with PIC, LCD proteus circuit with PIC, LCD working in proteus
  • Now place these components in the Proteus workspace and connect them.
  • Design exactly the same circuit as shown in the below figure for interfacing of LCD with PIC Microcontroller.
Circuit Designing of LCD with PIC on Proteus ISIS, LCD working code with PIC, LCD proteus circuit with PIC, LCD working in proteus

Now our circuit in Proteus is ready to use, the next step is to write a code for the PIC Microcontroller 18F452 and then burn it into the Proteus and check its working.

Code of LCD with PIC18F452

  • There are different compilers to write the code for PIC Microcontroller. Here I am using MikroC Pro for PIC. You can get it easily from the official site of MikroC.
  • I am not going in the details of coding as its beyond the scope of this tutorial, but still I am posting the code.
  • So now create a new project in the MikroC Pro For PIC and copy the below code and paste it in the project and compile.
  • When you compile the project, it will create a .hex file in the same folder where you have saved this project. We will use this hex file shortly.

// LCD module connections
sbit LCD_RS at RD2_bit;
sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;

sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
// End LCD module connections

char txt1[] = “www.TheEngineeri”;
char txt2[] = “ngProjects.com”;

char i;                              // Loop variable

void Move_Delay() {                  // Function used for text moving
Delay_ms(500);                     // You can change the moving speed here
}

void main(){

Lcd_Init();                        // Initialize LCD
Lcd_Cmd(_LCD_CURSOR_OFF);          // LCD Cursor Off
Lcd_Cmd(_LCD_CLEAR);               // Clear display

Lcd_Out(1,1,txt1);                 // Write text in first row
Lcd_Out(2,1,txt2);                 // Write text in second row

Delay_ms(2000);

while(1);
}

Burn the Code in PIC Microcontroller in Proteus ISIS

  • Now we have the hex file, we need to burn this hex file in the microcontroller in Proteus.
  • So, double click on the Microcontroller in Proteus and it will open up the properties menu of PIC microcontroller.
  • Now click, as shown in the below figure, and browse for the hex file and click OK.
  • We need to add this hex file in Proteus here and also select the oscillation frequency which I have selected 16MHz.
Circuit Designing of LCD with PIC on Proteus ISIS, LCD working code with PIC, LCD proteus circuit with PIC, LCD working in proteus
Note: Make sure that the oscillation frequency remain same both in the MikroC and the Proteus.
  • After adding the file in the Proteus now click OK and play the simulation, ifeverything goes fine, you will get the results as shown in below image.
Circuit Designing of LCD with PIC on Proteus ISIS, LCD working code with PIC, LCD proteus circuit with PIC, LCD working in proteus

Note:

  • Proteus ISIS simulation file and the .hex file has been emailed to all the subscribed members. If anyone need it, subscribe to our newsletter via email and it will be emailed to you as well.

That’s all for today, I have tried my best to explain everything on Interfacing of LCD with PIC Microcontroller, but still if someone having problem ask in comments and I will try to resolve. In the next part, we will discuss various components of Proteus which are commonly used like motors, serial port, hyper terminal etc. So stay tuned and also subscribe us via email so that you get all the tutorials straight into your mail box. Have fun. Take care.

24 Comments

    • Hi,

      you must be doing some mistake somewhere, Let me know what problem you are facing and does the copy the same code ???

      Thanks.

  1. Am new to the PIC stuffs…does the code u wrote on mikroC pro for PIC run on mikroC for PIC…what is the difference between the two?

  2. i want to write the name of circuit on the pcb but there is ground area probem. How to remove particulr ground area for write the name of circuit on ares.

  3. I have done the Domitian of LCD using ARM7 nd I didn’t connect crystall and reset to it ..Then how does the circuit simulate? If I want to connect crystal nd reset den what changes should I made in coding?

  4. Hi
    I done exactly as you said but getting errors when compiling the code
    the errors are:-

    3 300 Syntax Error: ‘;’ expected, but ‘at’ found PIC18f452.c
    3 424 ‘}’ expected ‘;’ found PIC18f452.c
    3 1163 Variable ‘LCD_RS’ has been declared, but not used PIC18f452.c
    27 393 ‘main’ Identifier redefined PIC18f452.c
    33 324 Undeclared identifier ‘txt1’ in expression PIC18f452.c
    33 1508 Implicit conversion of int to ptr PIC18f452.c
    34 324 Undeclared identifier ‘txt2’ in expression PIC18f452.c
    34 1508 Implicit conversion of int to ptr PIC18f452.c
    39 312 Internal error ” PIC18f452.c
    0 102 Finished (with errors): 18 Jan 2015, 19:47:21 PIC18f452.mcppi
    Im using MicroC pro v 6.0
    Any help will be appreciated
    Thanks for sharing your knowledge with us
    Ernest

  5. Dear Syed Zain Nasir Sb,
    AOA,realy u r doing an excellent and effortless work for others which is i think SADQA JARIA,God bless u all.
    I wanna ask that how arrows indicating current/signals directions are created in interactive simulation,Example lies in open samples (interactive simulation),Regards.
    ch wazir 03334290755.

    • Hi,

      Thanks a lot for appreciation, it works as a fuel for our team. 🙂
      Regarding your question, there are different ways to show current or voltage, you can find current/voltage probes in the left toolbar, place that probe on any point and you will get the voltage or current at that point depending which probe you are using.
      Moreover, you can also use Oscilloscope in Proteus and can check your current or voltage curve there. I have posted a tutorial on How to use Oscilloscope in Proteus, which can help you a lot.

      Thanks.

  6. Hey,
    I need of helps with a work about Protheus. I can to pay if is all OK. Send me a E-mail that we can to speak better. I’m a Brazilian student of electrical engineering. Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment