Sie sind auf Seite 1von 8

Article: 3

Learning to Use Arduino with Proteus (Programming of LCD)


By

Hassan Mehmood Khan

Date 19/1/2017
Introduction:
This article should help you to do basic setup of Arduino Controller in Proteus, programming
and simulation of Arduino in Proteus. In this article I have tried to make it simple to use LCD
with Arduino with some simulation and programming. As compared to my previous tutorial I
am using here Arduino Controller IC instead of Arduino Uno Board.
Proteusi:
Proteus combines ease of use with powerful features to help you design, test and layout
professional PCBs like never before. With nearly 800 microcontroller variants ready for
simulation straight from the schematic, one of the most intuitive professional PCB layout
packages on the market and a world class shape based autorouter included as standard,
Proteus Design Suite 8 delivers the complete software package for today and tomorrow's
engineers.
Proteus Arduino 328:

Proteus Arduino LCD Shield:

Article No: 3
Author: Engr. Hassan Mehmood Khan

Ver: 1.0
Date: 17/1/2017

Arduinoii:
Arduino is an open-source electronics platform based on easy-to-use hardware and software.
It's intended for anyone making interactive projects.
Custom Characters for LCD:

Each LCD characters is actually calculated as 5x7.


Initiate the character as a byte and copy the same code above for the byte value.
For Example: byte g[8]= { 0x00, 0x00, 0x0A, 0x04, 0x0A, 0x00, 0x0E, 0x00};
It is very useful tool to create custom characters. And you can display them on LCD.

Article No: 3
Author: Engr. Hassan Mehmood Khan

Ver: 1.0
Date: 17/1/2017

Steps:
1. Proteus Project:
To create the project follow the steps:
New Project>Create new project > Create a Schematic from the selected template
(Landscape A4)>Create a PCB layout (Generic)>Next>Firmware Project>Next>Finish.

2. Import Arduino 328 in Proteus:

Article No: 3
Author: Engr. Hassan Mehmood Khan

Ver: 1.0
Date: 17/1/2017

Import the Arduino 328 from the snippet folder:


Folder Location:
C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\Snippets

Import Steps:
Goto File>Import Project Clip
3. Import Arduino LCD Shield in Proteus:
Folder and Steps to import are same as of Arduino 328.

Article No: 3
Author: Engr. Hassan Mehmood Khan

Ver: 1.0
Date: 17/1/2017

4. Complete Circuit:
The complete circuit showed look like the following:

There is not any other component you need to put for the LCD programming.
5. Programming:
Follow the steps below to setup programming.

Source Code Section>System>Compilers Configuration

Article No: 3
Author: Engr. Hassan Mehmood Khan

Ver: 1.0
Date: 17/1/2017

Make Sure it is as per diagram above. If you have Arduino Software Install then it
should be already there. Otherwise just click Download and use Arduino AVR.
Use the Following Programme:

/* Main.ino file generated by New Project wizard


*
* Created: Fri Jan 6 2017
* Processor: ATmega328P
* Compiler: Arduino AVR */
#include <LiquidCrystal.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
LiquidCrystal lcd(8,9,4,5,6,7);
// make custom characters
byte g[8]= {0x00, 0x04, 0x0E, 0x1F, 0x1F, 0x04, 0x00, 0x00};
byte n[8]= {0x00, 0x04, 0x0E, 0x1F, 0x1F, 0x04, 0x00, 0x00};
//int motorPin1 = 2;
//int motorPin2 = 3;
void setup() // put your setup code here, to run once:
Article No: 3
Author: Engr. Hassan Mehmood Khan

Ver: 1.0
Date: 17/1/2017

{
//pinMode(motorPin1, OUTPUT);
//pinMode(motorPin2, OUTPUT);
lcd.begin(16,2);
//lcd.print("Motor ");
lcd.write(byte(0));
lcd.write(byte(2));
lcd.print(" Galaxian! ");
lcd.write(byte(0));
lcd.write(byte(2));
//lcd.print(" Fwd Dir");
}
void loop() // put your main code here, to run repeatedly:
{
lcd.noDisplay();
delay(500);
// lcd.clear();
// lcd.display();
lcd.createChar(0, g);
lcd.createChar(2, n);
lcd.setCursor(0,1);
lcd.print(millis()/1000);
lcd.setCursor(2,1);
lcd.print(" sec ");
lcd.setCursor(7,1);
lcd.print(millis()/1000*0.0167);
lcd.setCursor(10,1);
lcd.print(" min ");
lcd.display();
delay(500);
}

Article No: 3
Author: Engr. Hassan Mehmood Khan

Ver: 1.0
Date: 17/1/2017

6. Output Display:

The output display should look like below:

Resources:
i

https://www.labcenter.com/

ii

https://www.arduino.cc/

Article No: 3
Author: Engr. Hassan Mehmood Khan

Ver: 1.0
Date: 17/1/2017

Das könnte Ihnen auch gefallen