Lab #7: CPLD with LCD Displays SAIT- ENT-DIGI260

Lab #7: CPLD with LCD Displays

Created February 2008; updated January 2010

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 andon-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. Experimenter’s board with 5V power supply
  2. PC with access to specification sheets and other reference material
  3. Parts kit including the 74193 counter (additional parts available in the lab)
  4. On Loan: CPLD and the LCD Display
  5. In Lab: USB programming interface (for programming CPLD)

Additional Notes:

  1. LCD Displays and CPLDs are sensitive devices:
  2. The devices are sensitive to static discharge. Employ proper handling techniques. Use a ground strap.
  3. 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.
  4. The borrowed devices must be returned at the conclusion of the lab.
  5. Some classroom time may be provided to work on this lab.
  6. You must reference on-line materials and specification sheets to complete this lab. See the references section of the lab (last page).
  7. This is a 2-week lab.

Reference materials:

  • Classroom presentation materials from the DIGI260 web site for the CPLD, VHDL and general information on LCDs
  • Lookonline 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:

Pin configuration of the LCD Display Board (viewed from the top)

Pin # / Symbol / Function
1 / VSS / Ground
2 / VDD / 5 Volts
3 / VO / Display contrast input
4 / RS / Data (H) or Instruction (L)
5 / R/W’ / Read from (H) or Write to ( L)
6 / E / Enable (clocking edge)
7-14 / DB0~DB7 / Data Bus
15-16 / A-K / Backlight LED (not used)


Procedure 1:

Experimenting with the LCD Display

1- Referto 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 / DB6 / DB5 / DB4 / DB3 / DB2 / DB1 / DB0
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

2- Connect the LCD Display to the Experimenter’s board.

  1. Employ personal grounding.
  2. Ensure the experimenter’s board is turned off.
  3. Carefully connect the LCD Display to the experimenter’s board. Connect Vcc and ground.
  4. Connect the contrast (“LCD Driving Voltage”) input to a 10kΩpotentiometer as indicated in diagram #1.
  5. Connect the R/W’ to the appropriate value for write only.
  6. Connect E and RS to DIP switches.
  7. Connect DB0 to DB7 to the switches on the experimenter’s board.
  8. Apply power and adjust the contrast until a light grey background is visible on the display.

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.

  1. Compile the program, and program the CPLD.
  2. 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).
  3. Verify your connections to the CPLD and the LCD before applying power. Ensure there are no errors with Vcc/GND.
  4. 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.
  5. Print a copy of the program and include it with your lab submission.
  6. Print a floorplan of your device and include it with your submission.
  7. 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.

  1. 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).
  2. 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.
  3. Verify your connections to the CPLD and the LCD before applying power. Ensure there are no errors with Vcc/GND.
  4. Apply power and verify your results. You should see your name automatically typed to the LCD without any manual input.
  5. Demonstrate to the instructor.

Signatures:

Procedure 1 LCD basic display (“A” & “x”):______

Procedure 2Name displayed: ______

Procedure 4: Name is automatically displayed: ______

Submit: Floorplan and VHDL code.

LCD board#:

CPLD board#:

Items Returned in good condition: ______

Student Name: ______Date: ______

1