FPGA-Experiment One: Flashing lights (1)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.