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.
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.
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:
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.
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.
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.
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.
syedzainnasir
I am Syed Zain Nasir, the founder of The Engineering Projects (TEP). I am a
programmer since 2009 before that I just search things, make small projects and now I am sharing my
knowledge through this platform. I also work as a freelancer and did many projects related to
programming and electrical circuitry. My Google Profile+Follow
Get Connected
Comments on ‘’ Circuit Designing of LCD with PIC ‘’ ( 28 )
0
rida
Says:
Arduino: 1.8.9 (Windows 10), Board: "Arduino/Genuino Uno"
E:\Arduino\arduino-builder -dump-prefs -logger=machine -hardware E:\Arduino\hardware -tools E:\Arduino\tools-builder -tools E:\Arduino\hardware\tools\avr -built-in-libraries E:\Arduino\libraries -libraries C:\Users\rida rajput\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10809 -build-path C:\Users\RIDARA~1\AppData\Local\Temp\arduino_build_798585 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=E:\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=E:\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=E:\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=E:\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=E:\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=E:\Arduino\hardware\tools\avr -verbose F:\Seventh Semestr (Final YEar)\Embedded System\ALL LABS\EXP NO 05\lcd\lcd.ino
E:\Arduino\arduino-builder -compile -logger=machine -hardware E:\Arduino\hardware -tools E:\Arduino\tools-builder -tools E:\Arduino\hardware\tools\avr -built-in-libraries E:\Arduino\libraries -libraries C:\Users\rida rajput\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10809 -build-path C:\Users\RIDARA~1\AppData\Local\Temp\arduino_build_798585 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=E:\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=E:\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=E:\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=E:\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=E:\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=E:\Arduino\hardware\tools\avr -verbose F:\Seventh Semestr (Final YEar)\Embedded System\ALL LABS\EXP NO 05\lcd\lcd.ino
Using board 'uno' from platform in folder: E:\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: E:\Arduino\hardware\arduino\avr
Detecting libraries used...
"E:\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IE:\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IE:\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\RIDARA~1\\AppData\\Local\\Temp\\arduino_build_798585\\sketch\\lcd.ino.cpp" -o nul
Generating function prototypes...
"E:\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IE:\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IE:\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\RIDARA~1\\AppData\\Local\\Temp\\arduino_build_798585\\sketch\\lcd.ino.cpp" -o "C:\\Users\\RIDARA~1\\AppData\\Local\\Temp\\arduino_build_798585\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"E:\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\RIDARA~1\\AppData\\Local\\Temp\\arduino_build_798585\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"E:\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10809 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IE:\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IE:\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\RIDARA~1\\AppData\\Local\\Temp\\arduino_build_798585\\sketch\\lcd.ino.cpp" -o "C:\\Users\\RIDARA~1\\AppData\\Local\\Temp\\arduino_build_798585\\sketch\\lcd.ino.cpp.o"
lcd:17:1: error: stray '\342' in program
char txt1[] = “www.TheEngineeri”;
^
lcd:17:1: error: stray '\200' in program
lcd:17:1: error: stray '\234' in program
lcd:17:1: error: stray '\342' in program
lcd:17:1: error: stray '\200' in program
lcd:17:1: error: stray '\235' in program
lcd:18:1: error: stray '\342' in program
char txt2[] = “ngProjects.com”;
^
lcd:18:1: error: stray '\200' in program
lcd:18:1: error: stray '\234' in program
lcd:18:1: error: stray '\342' in program
lcd:18:1: error: stray '\200' in program
lcd:18:1: error: stray '\235' in program
lcd:2:1: error: 'sbit' does not name a type
sbit LCD_RS at RD2_bit;
^
lcd:3:1: error: 'sbit' does not name a type
sbit LCD_EN at RD3_bit;
^
lcd:4:1: error: 'sbit' does not name a type
sbit LCD_D4 at RD4_bit;
^
lcd:5:1: error: 'sbit' does not name a type
sbit LCD_D5 at RD5_bit;
^
lcd:6:1: error: 'sbit' does not name a type
sbit LCD_D6 at RD6_bit;
^
lcd:7:1: error: 'sbit' does not name a type
sbit LCD_D7 at RD7_bit;
^
lcd:9:1: error: 'sbit' does not name a type
sbit LCD_RS_Direction at TRISD2_bit;
^
lcd:10:1: error: 'sbit' does not name a type
sbit LCD_EN_Direction at TRISD3_bit;
^
lcd:11:1: error: 'sbit' does not name a type
sbit LCD_D4_Direction at TRISD4_bit;
^
lcd:12:1: error: 'sbit' does not name a type
sbit LCD_D5_Direction at TRISD5_bit;
^
lcd:13:1: error: 'sbit' does not name a type
sbit LCD_D6_Direction at TRISD6_bit;
^
lcd:14:1: error: 'sbit' does not name a type
sbit LCD_D7_Direction at TRISD7_bit;
^
lcd:17:18: error: 'www' was not declared in this scope
char txt1[] = “www.TheEngineeri”;
^
lcd:18:18: error: 'ngProjects' was not declared in this scope
char txt2[] = “ngProjects.com”;
^
lcd:26:11: error: '::main' must return 'int'
void main(){
^
F:\Seventh Semestr (Final YEar)\Embedded System\ALL LABS\EXP NO 05\lcd\lcd.ino: In function 'void Move_Delay()':
lcd:23:13: error: 'Delay_ms' was not declared in this scope
Delay_ms(500); // You can change the moving speed here
^
F:\Seventh Semestr (Final YEar)\Embedded System\ALL LABS\EXP NO 05\lcd\lcd.ino: At global scope:
lcd:26:11: error: '::main' must return 'int'
void main(){
^
F:\Seventh Semestr (Final YEar)\Embedded System\ALL LABS\EXP NO 05\lcd\lcd.ino: In function 'int main()':
lcd:28:10: error: 'Lcd_Init' was not declared in this scope
Lcd_Init(); // Initialize LCD
^
lcd:29:9: error: '_LCD_CURSOR_OFF' was not declared in this scope
Lcd_Cmd(_LCD_CURSOR_OFF); // LCD Cursor Off
^
lcd:29:24: error: 'Lcd_Cmd' was not declared in this scope
Lcd_Cmd(_LCD_CURSOR_OFF); // LCD Cursor Off
^
lcd:30:9: error: '_LCD_CLEAR' was not declared in this scope
Lcd_Cmd(_LCD_CLEAR); // Clear display
^
lcd:32:17: error: 'Lcd_Out' was not declared in this scope
Lcd_Out(1,1,txt1); // Write text in first row
^
lcd:35:14: error: 'Delay_ms' was not declared in this scope
Delay_ms(2000);
^
exit status 1
stray '\342' in program
this type of error occur in my coding i need immediate attention you.
Reply
100
1
3mp1re237
Says:
Hello friend, i just did mine and it works perfectly. Thanks for it . I don't think he used Arduino to run the program, try using mikroC Pro or any other C compiler for PIC.
Reply
100
2
syedghouse
Says:
i did this simulation but i am getting the error as
----mclr is low and processor is in reset---
Reply
100
3
3mp1re237
Says:
Try add a 10k resistor in series with the mlcr pin
Reply
100
4
maiquer
Says:
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!
Reply
100
5
chwazirahmad1
Says:
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.
Reply
100
6
syedzainnasir1
Says:
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.
Reply
100
7
prabhakaran
Says:
this website very useful to embedded design engineer...... really very nice admin....go ahead admin
Reply
100
8
ernest1
Says:
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
Reply
100
9
syedzainnasir1
Says:
You must be doing something wrong
Reply
100
10
ernest1
Says:
If possible can you please send me the hex and c flie.
Thanks
Ernest
Reply
100
11
newaz1
Says:
send me the file
Reply
100
12
adarsh1
Says:
When I will get the Proteus Professional software, I have already subscribed to your newsletter. adarsh33success@gmail.com
Reply
100
13
syedzainnasir1
Says:
We don't provide software
Reply
100
14
abhishekkumar
Says:
this is very helpful...
Reply
100
15
sanketh
Says:
plz pass me the proteus simulation and also the code
Reply
100
16
niki1
Says:
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?
Reply
100
17
nidhisaini1
Says:
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.
Reply
100
18
mohamoud
Says:
Thanx for the tutorial..grt job :)
Reply
100
19
mohamoud
Says:
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?
Reply
100
20
Says:
nothing is displayed...here's are d errors...plz help..
Reply
100
21
maryamjavaid
Says:
I followed ur all instructions bt nothing is displayed on LCD.can u tell me where i am doing mistake??
Reply
100
22
syedzainnasir1
Says:
Hi,
you must be doing some mistake somewhere, Let me know what problem you are facing and does the copy the same code ???
Thanks.
Reply
100
23
Says:
Can't we remove "text" in each component? I want to print the circuit i have in proteus. But it looks odd with these unnecessary text.
Reply
100
24
Says:
yeah you can easily remove the text ..... open the properties and remove the name of the component ..... just clear it and click OK.
Reply
100
25
Says:
This comment has been removed by the author.
Reply
100
26
Says:
keep up the good work :) i'll wait for other tutorial in ISIS proteus
Reply
100
27
Says:
Thanks for the appreciation bro .... it really meant a lot to the team ..... :))
Reply
I want to print the circuit i have in proteus.
But it looks odd with these unnecessary text. Reply
i'll wait for other tutorial in ISIS proteus Reply