Lab #6: CPLD/VHDL/LCD

advertisement
Lab #6: CPLD with LCD Displays
SAIT- ENT-DIGI260
Lab #6: CPLD with LCD Displays
Created February 2008; updated January 2010
Print all pages
Objectives:
1. Create a VHDL program to resolve a logic problem.
2. Program and interface a CPLD with an LCD Display using ASCII code.
3. Build a counter with oscillator to automatically cycle through the CPLD
program.
Pre-Lab Preparation:
1. Attend lectures and review the theory on basic VHDL language structure.
2. Read the textbook chapters and on-line materials and specification sheets
that relate to Altera’s 7000S series of CPLDs and the Quartus II
application software.
3. Attend lectures and review the theory of operation of the LCD display.
4. Convert ASCII code to binary values using available resources.
5. Assemble required resources such as LCD instruction sets and pin
configuration (see references section on the next page)
Equipment Required:
1.
2.
3.
4.
5.
Experimenter’s board with 5V power supply
PC with access to specification sheets and other reference material
Parts kit including the 74193 counter (additional parts available in the lab)
On Loan: CPLD and the LCD Display
In Lab: USB programming interface (for programming CPLD)
Additional Notes:
1. LCD Displays and CPLDs are sensitive devices:
a. The devices are sensitive to static discharge. Employ proper
handling techniques. Use a ground strap.
b. The devices are sensitive to input voltage issues. The input voltage
must be set to 5 Volts, the polarity must be correct, and the loads
must not exceed requirements.
2. The borrowed devices must be returned at the conclusion of the lab.
3. Some classroom time may be provided to work on this lab.
4. You must reference on-line materials and specification sheets to complete
this lab. See the references section of the lab (last page).
5. This is a 2-week lab.
1
Lab #6: CPLD with LCD Displays
SAIT- ENT-DIGI260
Reference materials:




Classroom presentation materials from the DIGI260 web site for the
CPLD, VHDL and general information on LCDs
Look online for ASCII converters or ASCII charts.
The device used is SAMSUNG CGROM (Character Generator ROM)
assembled by Lumex.
LCD Display information is also available here:
http://www.trash.net/~luethi/microchip/datasheets/datasheets.html
Pin configuration of the LCD Display Board (viewed from the top)
1
16
A
K
Pin #
Symbol
Function
1
2
3
4
5
6
7-14
15-16
VSS
VDD
VO
RS
R/W’
E
DB0~DB7
A-K
Ground
5 Volts
Display contrast input
Data (H) or Instruction (L)
Read from (H) or Write to ( L)
Enable (clocking edge)
Data Bus
Backlight LED (not used)
Note: This pinout is correct
DO NOT MIX Vcc and GND!
(Please do not use the internet to look
up this pinout…there are errors!)
2
Lab #6: CPLD with LCD Displays
SAIT- ENT-DIGI260
Procedure 1:
Experimenting with the LCD Display
1- Refer to specification sheets and ASCII conversion tools to determine the input
binary code sequence to perform a sequence of instructions (I) and data (D).
Complete the table below. Note the position of the MSB.
RS
Action
DB7
I
Clear the display and home position
I
Set the display to 2 lines
I
Set cursor to blink
D
Enter the character A
I
Go to the second line
D
Enter the character x
DB6
DB5
DB4
DB3
DB2
DB1
DB0
2- Connect the LCD Display to the Experimenter’s board.
a. Employ personal grounding.
b. Ensure the experimenter’s board is turned
off.
c. Carefully connect the LCD Display to the
experimenter’s board. Connect Vcc and
ground.
d. Connect the contrast (“LCD Driving Voltage”)
input to a 10kΩ potentiometer as indicated in
diagram #1.
Diagram #1
e. Connect the R/W’ to the appropriate value
for write only.
f.
Connect E and RS to DIP switches.
g. Connect DB0 to DB7 to the switches on the experimenter’s board.
h. Apply power and adjust the contrast until a light grey background is
visible on the display.
3
Lab #6: CPLD with LCD Displays
SAIT- ENT-DIGI260
3- Apply the values from step 1 to the switches.
Note that an edge needs to be provided to the LCD display for it to read
the input, and the RS input controls the input mode (Instruction or Data).
Observe the results and make any appropriate adjustments to the input
code. Make note what edge is active.
4- Demonstrate the completed output to the instructor (a single character “A”
on the first line and a single “x” on the second).
Procedure 2:
Write your name on the display using switched inputs.
1. Look up the appropriate code sequences for the letters in your name.
2. With the LCD connected to the switches manually enter the code sequences and
clock in your name to the LCD. Use both lines of the display.
3. Demonstrate your completed name to the instructor.
Procedure 3:
Use VHDL to design an ASCII output sequence.
1. Using VHDL, write a program that will write your name on the first and the
second line of the display. You will need to use reference materials.
2. The program should have a 5-bit binary up count pattern as the input and
produce the appropriate output for interfacing with the LCD display, including
instructions and data.
NOTE: The Enable input for the LCD display will be handled externally and
shouldn’t be included with the CPLD code.
NOTE: It is highly recommended that you manually assign the pins in the
software.
3. Compile the program, and program the CPLD.
4. Connect the CPLD inputs to the DIP switches on the experimenter’s board from
procedure 2. Connect the Enable input to the appropriate switch (hint: the E
input is edge-driven).
5. Verify your connections to the CPLD and the LCD before applying power.
Ensure there are no errors with Vcc/GND.
4
Lab #6: CPLD with LCD Displays
SAIT- ENT-DIGI260
6. Apply a digital count sequence to the DIP switches and manually clock in each
binary number, one after the other. Verify that your programmed instructions
function and the programmed characters are displayed.
7. Print a copy of the program and include it with your lab submission.
8. Print a floorplan of your device and include it with your submission.
9. Continue to procedure 4.
Procedure 4:
Automatically write your name on the display.
1. Ensure the experimenter’s board is turned off and that you are utilizing
appropriate static protection.
2. Design and build a counter that will provide the appropriate modulus for your
program.
NOTE: This counter must increment on the edge that is complimentary to the
Enable edge of the display.
3. Design and build a variable oscillator that will function at approximately 1Hz and
higher (you may also require a Schmitt to clean up the edges).
4. Connect the counter to the CPLD. Connect the oscillator output to the E input of
the display and to the clocking input of the counter. Again, the counter and the
Enable edges must function on complimentary edges.
5. Verify your connections to the CPLD and the LCD before applying power.
Ensure there are no errors with Vcc/GND.
6. Apply power and verify your results. You should see your name automatically
typed to the LCD without any manual input.
7. Demonstrate to the instructor.
5
Lab #6: CPLD with LCD Displays
SAIT- ENT-DIGI260
Signatures:
Procedure 1 LCD basic display (“A” & “x”):___________
Procedure 2 Name displayed: _____________
Procedure 4: Name is automatically displayed: ____________________
Submit: Floorplan and VHDL code.
LCD board#:
CPLD board#:
Items Returned in good condition: ____________________
Student Name: ____________________________ Date: ____________
6
Download