Today is New Year's Eve. I wish you all a happy Chinese New Year.
Today I plan to evaluate a chip temperature collection project according to the project provided in the manual. I have prepared a 1602 LCD screen with an I2C interface in advance, which looks like this:
There are four pins in total, VCC, GND, SCL, SDA. The biggest advantage of this LCD is that it saves connection pins compared to the parallel port.
There are three types of memory in 1602: CGROM, CGRAM, and DDRAM.
DDRAM (Display Data RAM) is the display data RAM, which is used to store the character codes to be displayed. A total of 80 bytes. If we want to display what we want on the screen, we can directly send the required character codes to the display memory.
The 1602 module has font memory, namely CGROM and CGRAM. The LCD1602 with I2C adapter can display 16x02, i.e. 32 characters, at the same time. The module has two 8-bit registers: instruction register (IR) and data register (DR). Users can select the specified register through the combination of RS and R/W input signals and perform corresponding operations.
RS |
R/W |
Instructions |
0 |
0 |
Write to instruction register (clear screen, etc.) |
0 |
1 |
Read the busy flag (DB7) and the address counter (DB0~DB6) value |
1 |
0 |
Write data register (display fonts, etc.) |
1 |
1 |
Read data from the data register |
1. Read status: Input RS=0, RW=1, E=high pulse. Output: D0-D7 is the status word.
2. Read data: Input RS=1, RW=1, E=high pulse. Output: D0-D7 is data.
3. Write command: Input RS=0, RW=0, E=high pulse. Output: None. (Set E=high pulse after writing)
4. Write data: Input RS=1, RW=0, E=high pulse. Output: None
The project code has four modules, I2C module, LCD module, TEMP_DESIGN_INIT and TOP module. The I2C module implements the transmission of address, data and other information in I2C timing. LCD implements the information display on 1602. The TEMP_DESIGN_INIT module is the official module for internal temperature and voltage acquisition.
The connection between LCD1602 and the development board is as follows:
set_property PACKAGE_PIN B11 [get_ports sda]
set_property PACKAGE_PIN B10 [get_ports scl]
set_property PACKAGE_PIN N14 [get_ports clk]
set_property PACKAGE_PIN L13 [get_ports rst_n]
set_property PACKAGE_PIN M15 [get_ports key1]
set_property PACKAGE_PIN L14 [get_ports key2]
From the constraint file, we know that SCL is connected to A0 of the development board, SDA is connected to A1, and the power supply is connected to 5v. In addition, two buttons K1 and SW3 are used to realize the display control of voltage and temperature.
After running the program, the interface displays the temperature curve:
But there is no display on the 1602 LCD, probably the device address is not configured correctly.
There is a loud sound of firecrackers outside, so let’s stop here for the test first.