0% found this document useful (0 votes)
27 views

HCMC University of Technology

- The document is a report on a mini project to build a system using NIOS II on a DE10 kit to connect an LCD display and H-bridge motor controller. - The system will display a blinking message when one switch is pressed, and display motor PWM duty cycle and frequency when another switch is pressed. - The project details the VHDL and NIOS II software components, including functions to send data and commands to the LCD, initialize the LCD display, and output values to the display based on switch states.

Uploaded by

Athen Okiff
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

HCMC University of Technology

- The document is a report on a mini project to build a system using NIOS II on a DE10 kit to connect an LCD display and H-bridge motor controller. - The system will display a blinking message when one switch is pressed, and display motor PWM duty cycle and frequency when another switch is pressed. - The project details the VHDL and NIOS II software components, including functions to send data and commands to the LCD, initialize the LCD display, and output values to the display based on switch states.

Uploaded by

Athen Okiff
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

HCMC University of Technology

Report Form
Subject: Microprocessor (Lab)
Mini Project
Class: TT03
Group Members:
1/ Tra Quoc Khang - 1951149
2/ Tran Hoang Lam -
3/ Do Hao Nam - 1911640
INDEX
I/ Introduction:
Topic of mini project: Build a system using NIOS II in kit DE10 to connect a
LCD 16 x 2 and H-bridge to control a motor. This system can do the following
tasks:
- When SW0 is ON, LCD blinks the sentence “Hello Word !!! ” in the middle
of row 1 with frequency Hz. (Using timer)
- When SW1 is ON, NIOS II controls the motor by sending PWM pulses to
the H-bridge. LCD displays the duty cycle and the frequency of PWM rules.
- When SW0 and SW1 is OFF, turn off the system.
Reference:
- Datasheet of LCD 16x2
- An instruction of LCD interference
- L298_H_bridge datasheet
II/ Process:
1. VHDL part:
 DE10 Kit:
Choose option as follows:
+) GIPO (default): need for connection with LCD 16x2 and 2 ports for H
bridge L298N.
+) Switch: need switch to the cases like the topic (SWITCH 0 and 1)

 Open Quartus 18.1 and open VHDL file:


 Open Platform Designer:

 In the Platform Designer, we have these blocks:


+) System and SDRAM Clocks for DE-Series Boards
+) NIOS II Processor
+) On-chip Memory (RAM or ROM) Intel FPGA IP
+) SDRAM Controller Intel FPGA IP
+) JTAG UART Intel FPGA IP
+) PIO (Parallel I/O) Intel FPGA IP (x4)
+) System ID Peripheral Intel FPGA IP
+) Interval Timer Intel FPGA IP

Fig.1: System and SDRAM Clocks for DE-Series Boards


Fig 2: NIOS II Processor
Fig 3: On-chip Memory (RAM or ROM) Intel FPGA IP

Fig 4: SDRAM Controller Intel FPGA IP


Fig 5: SDRAM Controller Intel FPGA IP

Fig 6: JTAG UART Intel FPGA IP


Fig 7: PIO (Parallel I/O) Intel FPGA IP (x4)
Fig 8: System ID Peripheral Intel FPGA IP
Fig 9: Interval Timer Intel FPGA IP
2. NIOS II ECLIPSE:
 Open NIOS II Software Build Tools for Eclispe.

 Next, we choose directory path for the software project and click OK.
- This is the code NIOS II Elispe of our group. In this part, we will introduce
each function and explain it.
 The 1st function:

This function ,”void send_data(unsigned char data)”, means that it is used


to write the data we want display in LCD to PIO. To be more clearly, the data
(0x500+data) will be written into the address of register LCD_BASE, after waiting
200ms, it continues add the data (0x100+data) to the address of this register.
 The 2nd function:
This function is used to make own commands and test them. The first
function is used to add the data (0x400+cmd) into the LCD_BASE register. Then,
after waiting 200ms, the data(0x000+cmd) is added into the register
 The 3rd function:

In this function, we will write the data into the register LCD_BASE in the 1st
function above, and in this case, we write each character in the world “Hello
World!!! ” to the register. After waiting 200ms, we will use command “Clear
Display Screen” in the function “send_cmd(0x001)” and return the function.
 The 4th function:
This function is used to configure the LCD display. To figure this we have
four command words are sent to LCD, including:
1) Function set(“send_cmd(0x038)”)
2) Display On/Off control(“send_cmd(0x00E)”)
3) Entry mode set (“send_cmd(0x006)”)
4) Display clear (“send_cmd(0x001)”)
To be more clearly, we will present the chart of these steps below:
 The 5th function:

In this function, we use to output the frequency to the screen LCD by using
the function “send_data” in the 1st function. It prints “Freq: 1kHZ” to the LCD
screen and in the function “send_cmd(0x0C0)”, this means that we will display the
“Duty: 50%” into the second line.
 The 6th function:

 The main function: (chưa xong)


In the main function, we declare a static variable “alt_alarm alarm” which
memorizes every time we call it. In the next steps, we will do a loop “while” which
keep going when it equals 1. We have function
“IORD_ALTERA_AVALON_PIO_DAT” is used to read the state of ALL
SWITCH.
In the 1st case, the SW 0 is set to 1 and it is showed by the return value is
0x01. It runs the function “lcd_start()” in the 4th function. In the case

You might also like