Tutorial 7 Using the Spartan 3E Starter Board LCD Display with a Counter

Similar documents
VGA video signal generation

Digital Design with VHDL

VHDL Test Bench Tutorial

if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;

Lenguaje VHDL. Diseño de sistemas digitales secuenciales

12. A B C A B C A B C 1 A B C A B C A B C JK-FF NETr

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

VHDL programmering H2

LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER

Initial Design for Spartan-3E Starter Kit

Lab 7: VHDL 16-Bit Shifter

An Example VHDL Application for the TM-4

Lab 1: Introduction to Xilinx ISE Tutorial

Implementation of Web-Server Using Altera DE2-70 FPGA Development Kit

VHDL GUIDELINES FOR SYNTHESIS

! " # # $ '"() * #! +, # / $0123$

From VHDL to FPGA

CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni

(1) D Flip-Flop with Asynchronous Reset. (2) 4:1 Multiplexor. CS/EE120A VHDL Lab Programming Reference

Hardware Implementation of the Stone Metamorphic Cipher

PLL Dynamic Reconfiguration Author: Karl Kurbjun and Carl Ribbing

Rotary Encoder Interface for Spartan-3E Starter Kit

Modeling Latches and Flip-flops

Design of Remote Laboratory dedicated to E2LP board for e-learning courses.

Digital Systems Design! Lecture 1 - Introduction!!

Sprites in Block ROM

In this example the length of the vector is determined by D length and used for the index variable.

Step : Create Dependency Graph for Data Path Step b: 8-way Addition? So, the data operations are: 8 multiplications one 8-way addition Balanced binary

CPE 462 VHDL: Simulation and Synthesis

FPGA Implementation of an Advanced Traffic Light Controller using Verilog HDL

Asynchronous & Synchronous Reset Design Techniques - Part Deux

EZ DUPE DVD/CD Duplicator

Printed Circuit Board Design with HDL Designer

Modeling Registers and Counters

8-ch RAID0 Design by using SATA Host IP Manual Rev1.0 9-Jun-15

Generating MIF files

No serious hazards are involved in this laboratory experiment, but be careful to connect the components with the proper polarity to avoid damage.

CHAPTER 11: Flip Flops

Introduction to the Altera Qsys System Integration Tool. 1 Introduction. For Quartus II 12.0

Using Xilinx ISE for VHDL Based Design

Lesson 1 - Creating a Project

AES (Rijndael) IP-Cores

Digital Design with Synthesizable VHDL

A New Paradigm for Synchronous State Machine Design in Verilog

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

Digital Systems Design. VGA Video Display Generation

Next Generation Modeling and Simulation Engineering using Cloud Computing

Xilinx Answer Data2Mem Usage and Debugging Guide

Lab 1: Full Adder 0.0

GB ethernet UDP interface in FPGA

ISE In-Depth Tutorial. UG695 (v14.1) April 24, 2012

Start Active-HDL by double clicking on the Active-HDL Icon (windows).

The Little Man Computer

Standard of the Camera & Imaging Products Association. White Paper. of CIPA DC Picture Transfer Protocol over TCP/IP networks

Changing printer settings 1

Keywords RFID READER, FPGA, GSM.

Quartus II Introduction for VHDL Users

Introduction to Programmable Logic Devices. John Coughlan RAL Technology Department Detector & Electronics Division

Digital Circuit Design Using Xilinx ISE Tools

ECE 451 Verilog Exercises. Sept 14, James Barnes

Jianjian Song LogicWorks 4 Tutorials (5/15/03) Page 1 of 14

Device Type Manager (DTM) Basic HART

Xenomai: integration and qualification of a real time operating system ARMadeus Systems

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

Using ModelSim, Matlab/Simulink and NS for Simulation of Distributed Systems

4511 MODBUS RTU. Configuration Manual. HART transparent driver. No. 9107MCM100(1328)

Device Type Manager (DTM) for AS800

ModelSim-Altera Software Simulation User Guide

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

The 104 Duke_ACC Machine

Getting Started Using Mentor Graphic s ModelSim

An Integer Square Root Algorithm

Manchester Encoder-Decoder for Xilinx CPLDs

After opening the Programs> Xilinx ISE 8.1i > Project Navigator, you will come to this screen as start-up.

First Steps with CoDeSys. Last update:

8051 MICROCONTROLLER COURSE

ROC Protocol Specifications Manual

a8251 Features General Description Programmable Communications Interface

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path

COMPUTER SCIENCE TRIPOS

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

Multiplexers Two Types + Verilog

AGIPD Interface Electronic Prototyping

10/100 Mbps Ethernet MAC

Figure 1: Graphical example of a mergesort 1.

Digital Design and Synthesis INTRODUCTION

Designing Digital Circuits a modern approach. Jonathan Turner

3. Programming the STM32F4-Discovery

Design and Implementation of Vending Machine using Verilog HDL

CCNA R&S: Introduction to Networks. Chapter 5: Ethernet

ISE In-Depth Tutorial 10.1

The new frontier of the DATA acquisition using 1 and 10 Gb/s Ethernet links. Filippo Costa on behalf of the ALICE DAQ group

Fractional Burst Clock Data Recovery for XG-PON Applications Author: Paolo Novellini and Massimo Chirico

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

Decimal Number (base 10) Binary Number (base 2)

9/14/ :38

RS-485 Protocol Manual

Transcription:

Tutorial 7 Using the Spartan 3E Starter Board LCD Display with a Counter Introduction The LCD (Liquid Crystal Display) in question is included with the Spartan 3E Starter Board Kit sold by both Digilent. LCD s in general offer a cheap and convenient way to deliver information from electronic devices. Indeed, it is that very convenience that has led to the LCD s near ubiquity in today s electronic world. Information relevant to the LCD s operation is in the previous tutorial, where the LCD was used to display FPGA. Other than the alteration of the main state machine, this lab is a near duplicate of the previous. Writing numbers on the LCD is surprisingly simple. The chart in the previous lab or manual specifies that for the numbers 0 9 the upper data nibble is always 3. Furthermore, the lower data nibble corresponds exactly to the number. Thus, the number 8, is 0011 concatenated with 1000, or 0x38. Objective To use the S3E Starter Board s LCD display to display the consecutive numbers of a counter up to 9, and learn more about digital logic design in the process. Process 1. Implement hardware to control the LCD. 2. Verify the hardware in software (Modelsim). 3. Program the S3E Starter Kit Board. Implementation Again, this project requires 3 state machines. One for the power on initialization sequence, one to transmit commands and data to the LCD and lastly, one to start the power on initialization sequence, then configure and write to the LCD. In this case, the main state machine that controls the others will never end. Instead it will loop forever, setting the DD RAM address to 0x00, and then writing the character that corresponds to the number of a counter. 1

Here, the main state machine initializes the display as detailed previously, but then deviates by continuously setting the address to 0x00 and writing a character updated by a counter implemented as a separate process. 2

This is a 30ms simulation of properly working LCD Counter hardware. Notice how although the number being displayed doesn t change, the main state machine continues to loop and set the address to 0x00 and rewrite the character. 3

This simulation shows an actual change in the number being displayed. 4

Written by Rahul Vora for the University of New Mexico rhlvora@gmail.com library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; Uncomment the following library declaration if instantiating any Xilinx primitives in this code. library UNISIM; use UNISIM.VComps1nts.all; entity lcd is port( clk, reset : in std_logic; SF_D : out std_logic_vector(3 downto 0); LCD_E, LCD_RS, LCD_RW, SF_CE0 : out std_logic; LED : out std_logic_vector(7 downto 0) ); end lcd; architecture behavior of lcd is type display_state is (init, function_set, s1, entry_set, s2, set_display, s3, clr_display, s4, pause, set_addr, s5, update, s6, done); signal cur_state : display_state := init; signal SF_D0, SF_D1 : std_logic_vector(3 downto 0); signal LCD_E0, LCD_E1 : std_logic; signal mux : std_logic; type tx_sequence is (high_setup, high_hold, oneus, low_setup, low_hold, fortyus, done); signal tx_state : tx_sequence := done; signal tx_byte : std_logic_vector(7 downto 0); signal tx_init : std_logic := '0'; signal tx_rdy : std_logic := '0'; type init_sequence is (idle, fifteenms, s1, s2, s3, s4, s5, s6, s7, s8, done); signal init_state : init_sequence := idle; signal init_init, init_done : std_logic := '0'; signal i : integer range 0 to 750000 := 0; signal i2 : integer range 0 to 2000 := 0; signal i3 : integer range 0 to 82000 := 0; signal i4 : integer range 0 to 50000000 := 0; signal num : std_logic_vector(3 downto 0); begin LED <= tx_byte; for diagnostic purposes SF_CE0 <= '1'; disable intel strataflash LCD_RW <= '0'; write only when to transmit a command/data and when not to with cur_state select tx_init <= '1' when function_set entry_set set_display clr_display set_addr update, '0' when others; control the bus with cur_state select mux <= '1' when init, 5

'0' when others; control the initialization sequence with cur_state select init_init <= '1' when init, '0' when others; register select with cur_state select LCD_RS <= '0' when s1 s2 s3 s4 s5, '1' when others; with cur_state select tx_byte <= "00101000" when s1, "00000110" when s2, "00001100" when s3, "00000001" when s4, "10000000" when s5, "0011"&num when s6, "00000000" when others; counter: process(clk, reset) begin if(reset = '1') then i4 <= 0; num <= "0000"; elsif(clk='1' and clk'event) then if(i4 = 50000000) then i4 <= 0; if(num = "1001") then num <= "0000"; num <= num + '1'; i4 <= i4 + 1; end process counter; main state machine display: process(clk, reset) begin if(reset='1') then cur_state <= init; elsif(clk='1' and clk'event) then case cur_state is when init => if(init_done = '1') then cur_state <= function_set; cur_state <= init; when function_set => cur_state <= s1; when s1 => cur_state <= entry_set; cur_state <= s1; when entry_set => cur_state <= s2; 6

when s2 => cur_state <= set_display; cur_state <= s2; when set_display => cur_state <= s3; when s3 => cur_state <= clr_display; cur_state <= s3; when clr_display => cur_state <= s4; when s4 => i3 <= 0; cur_state <= pause; cur_state <= s4; when pause => if(i3 = 82000) then cur_state <= set_addr; i3 <= 0; cur_state <= pause; i3 <= i3 + 1; when set_addr => cur_state <= s5; when s5 => cur_state <= update; cur_state <= s5; when update => cur_state <= s6; when s6 => cur_state <= set_addr; cur_state <= s6; when done => cur_state <= done; end process display; end case; with mux select 7

SF_D <= SF_D0 when '0', transmit SF_D1 when others; initialize with mux select LCD_E <= LCD_E0 when '0', transmit LCD_E1 when others; initialize with tx_state select tx_rdy <= '1' when done, '0' when others; with tx_state select LCD_E0 <= '0' when high_setup oneus low_setup fortyus done, '1' when high_hold low_hold; with tx_state select SF_D0 <= tx_byte(7 downto 4) when high_setup high_hold oneus, tx_byte(3 downto 0) when low_setup low_hold fortyus done; specified by datasheet transmit : process(clk, reset, tx_init) begin if(reset='1') then tx_state <= done; elsif(clk='1' and clk'event) then case tx_state is when high_setup => 40ns if(i2 = 2) then tx_state <= high_hold; tx_state <= high_setup; when high_hold => 230ns if(i2 = 12) then tx_state <= oneus; tx_state <= high_hold; when oneus => if(i2 = 50) then tx_state <= low_setup; tx_state <= oneus; when low_setup => if(i2 = 2) then tx_state <= low_hold; tx_state <= low_setup; when low_hold => if(i2 = 12) then tx_state <= fortyus; 8

tx_state <= low_hold; when fortyus => if(i2 = 2000) then tx_state <= done; tx_state <= fortyus; when done => if(tx_init = '1') then tx_state <= high_setup; tx_state <= done; end case; end process transmit; with init_state select init_done <= '1' when done, '0' when others; with init_state select SF_D1 <= "0011" when s1 s2 s3 s4 s5 s6, "0010" when others; with init_state select LCD_E1 <= '1' when s1 s3 s5 s7, '0' when others; specified by datasheet power_on_initialize: process(clk, reset, init_init) power on initialization sequence begin if(reset='1') then init_state <= idle; elsif(clk='1' and clk'event) then case init_state is when idle => if(init_init = '1') then init_state <= fifteenms; init_state <= idle; when fifteenms => if(i = 750000) then init_state <= s1; init_state <= fifteenms; when s1 => if(i = 11) then 9

init_state<=s2; init_state<=s1; when s2 => if(i = 205000) then init_state<=s3; init_state<=s2; when s3 => if(i = 11) then init_state<=s4; init_state<=s3; when s4 => if(i = 5000) then init_state<=s5; init_state<=s4; when s5 => if(i = 11) then init_state<=s6; init_state<=s5; when s6 => if(i = 2000) then init_state<=s7; init_state<=s6; when s7 => if(i = 11) then init_state<=s8; init_state<=s7; when s8 => if(i = 2000) then init_state<=done; 10

init_state<=s8; when done => init_state <= done; end behavior; end case; end process power_on_initialize; This tutorial was written by Rahul Vora. Rahul is an engineering student in the department of Electrical and Computer Engineering at the University of New Mexico. He can be reached at rvora@unm.edu. 11