Buy Project Set 3
|
| LCD Display |
|
|
|
|
| 1. Get the components on hand and solder them up! |
From PR3 onwards, we encourage you to upgrade your PIC from PIC16F84A (18 pins) to PIC16F877A (40 pins) and to solder all the components on a donut board based on a few reasons:
- The devices that we are going to control, are getting more complicated and require more I/O pins.
- The protoboard might not have sufficient space to plug in all the components and jumpers, moreover it looks messy and unsystematic.
- You are expected to be familiar with the electronic components after working with PR1, PR2 and this is the time for you to learn soldering skill. However, you still able to control a LCD with a 16F84A and protoboard, not a big deal!
In this project, we are using a JHD162A (with backlight) 2 x16 characters LCD which has the same pin configuration with Hitachi HD44780 (without backlight).
| 1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
| Gnd |
+5V |
Vee |
R/S |
R/W |
E |
D0 |
D1 |
D2 |
D3 |
D4 |
D5 |
D6 |
D7 |
+ |
- |
We can control the LCD using either with 8 pins (8-bit interface) or 4 pins (4-bit interface), depending on the I/O pins you have. For 16F877A which has 33 I/O pins, there should be no problem in using the 8-bit interface which is much easier.
The pin 15 and 16 is for LCD backlight which is optional for you whether you want the light to be switched on. FYI, switching on the backlight of LCD will cause your battery to dry up rapidly.
The 3rd pin (Vee) needs to be connected to a variable resistor to control the LCD contrast, while the R/W (read or write) pin is connected to the ground.
R/S and E are connected to RD2 and RD3 to your PIC respectively. For data communication pins, D0-D7 (8-bit) is connected directly to RB0-RB7 of your PIC. For more detail about the LCD, please view the datasheet.
In this project, I would like to take the opportunity to introduce you, our new PIC aided tool – SK40A start up kit which I think is among the best development tool for a PIC user to develop a project.
By using this start-up kit, user can easily develop a desired circuit board without concern about the basic circuit of PIC such as voltage regulator, crystal, reset mode, bootloader and so on. Below is the schematic for PR3 using SK40A, PIC16F877A, 10K variable resistor and a JHD 162A LCD.
|
| 2. Install MPLAB in order to compile your own source code. |
Please click here to review how to setup MPLAB.
To change the display on LCD is very easy. What you need is just refer to the table below and change the value of the 8 bit data (RB0-RB7). Try to download the sample source code, and you will know how easy it is!
|
| 3. Setup the hyper terminal and download your hex file into PIC using bootloader. |
One of the advantages using SK40A is the availability to load the program easily. With bootloader firmware on your PIC, program can be easily loaded into PIC without unplugging it from your board. (The bootloader firmware is preprogrammed in your PIC if you buy the project set 3). Please follow the steps below to setup the hyper terminal and enjoy the boot function!
3.1 Get ready your HYPERTERMINAL
- HyperTerminal is a software available in all windows
- Opening the HyperTerminal: Click Start-> All Programs-> Accessories-> Communications-> HyperTerminal
- Setting up the Hyper Terminal (first time user):
- Once you entered Hyper Terminal, key in any name under Name: and choose any icons.
Example: Name: Bootloader. Upon completion, click ok
- Choose connect using:COM1, then click ok.
- Choose the following details:
Bits per second : 9600
Data bits : 8
Parity : None
Stop bit : 1
Flow control : None
After performing the selection, click ok.
- Select Call-> Disconnect
- Next, to change the character delay, select File-> Properties-> Setting, go into “ACSII Setup” submenu. Change the character delay to 10 milliseconds
- Then, save the file by selecting: File-> Save as. Key in the filename you prefer and press save.
- Close the Hyper Terminal
- Open the file that you have just saved. Click Start-> All Programs-> Accessories-> Communications-> HyperTerminal -> Filename.ht
You have completed setup your hyper terminal. Once your program is ready and a hex file is generated, you are required to use bootloader to load your program into SK40A, to enable your program to be executed. Following description show the methods in detail:
3.2 Get ready your serial port connection
- Plug in the microcontroller at the socket. Make sure that the arrangement is exactly the same as the picture below.
- Provide power to the start-up kit
- Use the Serial Port Cable provided.
- Connect one side of the cable to the start-up kit and the other side to the serial port of the computer or laptop.
*CAUTION* The microcontroller should never be plugged- in, at the wrong position!
3.2 Get ready your serial port connection
In order to start booting your PIC, switch on the power for SK40A, then press hold the 'Boot' button followed by pressing the 'Reset' button. Release the 'reset' button first, then release the 'Boot' button.
- Once the buttons are released, the wording "www.cytron.com.my" will appear on the screen.
- Next is to transfer the Hex file to the PIC Microcontroller. Select Transfer-> Send Text File. Under Files of type, choose All files. Choose the Hex file that you want to transfer and click open.
- When the transfer is successful, the wording "Done! Reset PIC to run" will appear on the screen.
When this appears, you can press the 'Reset button' and your LCD will display your desired characters.
|
| Buy Project Set 3 |
|
|