The first experiment simply implements a flashing light program (mainly to review the syntax, simulation, and download process)
The basic idea is to use the counter to Count 0.5s, and then change the status of the following led output pins every 0.5s
The hardware circuit is as follows: (the corresponding connection in the FPGA, given in the code comment)
1. In the last created design file, enter the following:
(This experiment is mainly to do a demonstration, after the construction of the project and other steps not to repeat)
1 /*********************************************2 * File name: LED.V3 * Function: Realize the LED light flashing on the development Board (blink frequency is 1s)4 * Platform: Win7 Quartus II 64bit5 * Connection: CLK--6 Rst_n--7 LED0--8 *********************************************/9 Ten ModuleLED ( One Clk,rst_n, A LED0 - ); - the inputCLK; - inputRst_n; - OutputLED0; - + //************************************ - //because the board crystal oscillator is 50m,0.5 second is to + //0.5*50*1000_000 = 25_000_000 times Count A parameterHalf_sec = -'d25_000_000; at //************************************ - - //************************************ - Reg[ -:0]count; - - always@(PosedgeClassor Negedgerst_n) in begin - if(!rst_n) toCount <= -'D0; + Else if(Count = =half_sec) -Count <= -'D0; the Else *Count <= Count +1'B1; $ EndPanax Notoginseng - //*********************************** the RegrLED0; + A always@(PosedgeClassor Negedgerst_n) the begin + if(!rst_n) -RLED0 <=1'B0; $ Else if(Count = =half_sec) $RLED0 <= ~rLED0; - End - the AssignLED0 =rLED0; - Wuyi the Endmodule
2. Save the file and synthesize the design
When the integration is complete, the Task window appears as shown below:
3. Assign Pins Next
Click on the icons below
Displayed as follows: Then directly in the diagram to mark the part, modify the connection on the Development Board can be
When the modification is complete, close this interface.
3. Note that after the synthesis there is a warning:
This refers to the unused pin settings, generally we want to set the PIN as: input tri-state!
Open Assignments--device
Shown below: Click Device and PIN options
Shown below: Select as input tri-stated in unused pins
Finally click OK
FPGA-Experiment One: Flashing lights (1)