Recent Changes - Search:

Introduction to Microcontroller Programming

About PICmicro Chips

Clocking Your PICmicro Devices

E-Blocks

Flowcode Step By Step

PICmicro Projects

Labs

Lab 8 - LCD

<^< 7. Decision | Course Index | 9. Keypad >^>

1. Introduction

The LCD: things really get interesting from now on. Using LEDs as outputs is nice but is still binary and only numbers are possible. The LCD is a much better way for the microcontroller to give info back to ‘non binary’ humans.

2. Setting up the equipment
3. Hardware settings
EB006 OptionsSettingJumper settings (EB006)Jumper settings (HP488)
Power supplyExternal, 14VJ29: PSUJ29: PSU
PICmicro device16F1937  
Programming methodUSBJ12,13,14: USBJ20: USB
Clocking methodXTALSW2: RCS2: XTAL
R/C clock speed   
Xtal frequency19 660 800 Hz  
LVP Jumper selectionI/O PortJ11,16,17: I/O PortJ15,16,18: I/O
Port A E-block   
Port B E-blockLED board  
Port C E-blockSwitch board  
Port D E-blockLCD board  
Port E E-block   
4. Flowcode and download settings
Build > Project Options... > General Options Build > Project Options... > Configure
OptionsSetting
Clock speed19 660 800 Hz
Simulation speed10
OptionsSetting
Device16F1937
RC/XTXTAL
Watchdog timerOff
5. Software learning objectives

Input, output, binary code training, using a hardware macro (LCD), working with text, string variables and string manipulation.

6. Hardware learning objectives

LED’s, logic output levels, how LCD’s work, 4 bit mode LCD driver, that LCD’s need a stable clocked PIC to drive them, that LCD’s have their own processor on board.

7. Instructions

Construct the system shown from E-blocks.

In the course navigate to the ‘Flowcode step-by-step’ and review the section on The LCD Display (step 5). The descriptions of the Multiprogrammer board , the Switch board, the LCD and the LEDboard are in the E-blocks section.

You will need to look into the 'Help' menu and function in Flowcode to get the info you need on string manipulation. The sections on LCD Display and String manipulation functions will come in handy.

During these exercises you are going to send data to the LCD display. When a microcontroller needs to send data to an LCD, than the microcontroller has to be clocked quite stable. An XTAL clock is perfect for this, an RC clock is not. Be aware of this.

8. Labs
Letter Meaning
L Lab x
B Basic complexity
I Intermediate complexity
E Expert complexity
L8-B1
Display the text “Hello World” in the center of the bottom line of the 2x16 LCD display.
L8-B2
Display the lines of text below, one after the other. First show each line of text in the center of the bottom line, then move it up to the center of the top line of the LCD. This should give a scrolling effect to your message. Leave every bit of text 2 seconds on the bottom line and 2 seconds on the top line. While one line of text moves to the top line, the next one fills up the bottom line. Text: “There are only”, ”10 kinds”, ”of people !”, “Those who”, “understand”, “BINARY”, “and those who”, “DON’T….”. Put it all in an infinite loop. Download this program to the PIC and test it.
L8-B3
Use either loops or decisions to make a program that count up when SW0 is pressed and counts down when SW1 is pressed. The status of the count is shown on the LEDs of port B and on the LCD.
L8-B4
Show the status of the switches at port C on the LEDs at port B and on the LCD. Every time one or more switches are pressed, the corresponding LEDs of port B should light up and the corresponding decimal number should be displayed on the LCD.
L8-B5
Show the status of the switches at port C on the LEDs at port B and on the first line of the LCD. Multiply this binary number by 100 and display this result on the second line of the LCD. Add the text [x 100 =] in front of this result. Download this program to the PIC and test it.
L8-B6
Display this text on the LCD: [R15=560Ω] use the printASCII command to print the Ω-sign. Download this program to the PIC and test it.
L8-B7
Load a string variable called MyStrA[20] with “Hello“ with the string manipulation icon using the line (MyStrA = “Hello ”). Display this string variable on the LCD using the ‘PrintString’ command and as a parameter use: ‘MyStrA’ without [].
L8-B8
Load a string variable called MyStrA[20] with “Hello” and a second string variable MyStrB[20] with “Matrix” with the string manipulation icon. The display has to show “Hello Matrix”. Find out how to do this by just using a simple string manipulation.
L8-B9
Load a string variable called MyStrA[20] with “Hello” and a second string variable MyStrB[20] with “Matrix”. The display has to show “HELLO MATRIX”. Find out how you can do this by just using a simple string manipulation. Download this program to the PIC and test it.
L8-I9
Load a string variable called MyStrA[20] with “Hello” and a second string variable MyStrB[20] with “Matrix”. The display has to show [ello MATRIX =13]. Accomplish this by using different string manipulations. Find out how to display this string length just by using a simple string manipulation. The number changes automatically when the length of the string changes. Download this program to the PIC and test it.
L8-E10
Load a string variable called MyStrA[20] with “Hello” and a second string variable MyStrB[20] with “Matrix”. The display has to show “xirtaM olleH”. Download this program to the PIC and test it.
L8-B11
Add an LCD to the sheepcounter program [L7-E10]. Display the number of sheep in both paddocks at all times in decimal format on the LCD. You decide how this should look like.
L8-I12
Draw up the full circuit diagram of the PIC with 8 LEDs on port B and 8 switches on port C and the LCD on port D, including the clocking circuit, the reset circuit, VDD and VSS connected to the PIC and the correct current limiting resistors connected between LEDs, switches and PIC. If you prototyped this circuit and connected power to it, it should behave exactly the same as the E-blocks system in front of you. Schematics in the E-blocks section and the full circuit diagrams in the datasheets of the E-blocks will come in handy when you do this task.

<^< 7. Decision | Course index | 9. Keypad >^>

Print - Search - Login

Page last modified on May 13, 2013, at 03:36 PM