3.1 Experiment Objective
Review Experiment 1, the setting for PLL, design of frequency division, and the compilation of the code
Study the BCD code counter
Design of 7 segment decoder
Download the program into the board flash memory
3.2 Experiment Requirement
The highest two segment decoders display hours, the middle two are for minutes, and the lowest two display the seconds.
The decimal point will be off all the time. It will not be considered in this case.
3.3.1 Build New Project
See Experiment 1
3.3.2 PCB Schematics
In Fig 3. 1, six 7 segment decoders are used in this experiment. Some points need to be paid attention.
The segment names are shown above. A, B, C, D, E, F, and G correspond to the digital tube, while DP stands for the decimal point. D0, D1, D2, D3, D4, and D5 (on the rightest part) are for the current driver.
They are common anode segment decoders, D0- D5 are set high or low to control the segment decoders.
For the main segments, A- G are lit when the input is low, that is, ‘0’ is high.
The segment decoder code is given as follows
always @ (*)
always @ (posedge sys_clk)
5. Dynamic Scanning for human eyes. Since human eyes have visual persistence characteristics, the speed to illuminate the segment decoders is fast enough that it cannot be distinguished by naked eyes. Therefore, it can be viewed as consistent lighting instead of blinking. Like the running LED, one decoder is lit at one time, implemented in the form of low-level loop left shift
3.3.3 Experiment Procedure
For the frequency division design, see Experiment 1.
Dynamic scanning is implemented by the state machine. The relationship of conversion should be considered.
The code implementation of one-to-one segment should be precise.
Check the pin assignments before downloading the program to the board. Pin assignment file can be referred in the reference file.
3.3.4 Configuration Serial Flash Programming
In Fig 3. 2, the functionality of Flash is to save the uploaded program even after the power is turned off. If the power is on next time, the program can be running on the board immediately. It is a very useful characteristic. The specific configuration process is as follows:
File > Convert Programming Files, as shown in Fig 3. 3
In Programming file type, choose JTAG Indirect Configuration File(.jic)
For Configuration device, choose EPCQ 128A (compatible development board N25Q128A)
In Mode, choose Active Serial
Fig 3. 3 Set .jic file
- Click Advanced and set as in Fig 3. 4
Fig 3. 4 Set the advanced option
- Click SDF Data, and then Add File, find *.sof file in the output_files. See Fig 3. 5
Fig 3. 5 Add a conversion file
- Add device. See Fig 3. 6
Click Generate, and BCD_counter.jic file will be generated.
Fig 3. 6 Add device
- Follow the same downloading procedure in previous experiments. Observe the segment decoder on develop board.