Circuit Designing of LCD with PIC

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.
Circuit Designing of LCD with PIC

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 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.

simply double click on it and it will be added in your database so that you can use them

  • 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:

The below image shows the components which we are gonna use in this project

  • 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.

Design exactly the same circuit as shown in the below figure for interfacing of LCD with PIC Microcontroller

  • 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.

Burn the Code in PIC Microcontroller in Proteus ISIS

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.

After adding the file in the Proteus now click OK and play the simulation

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.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter