Simple 8 leds flasher with options delay

Examples of programs here is same with the previous example, just added the option of delay using combination of switchs. Consists of two switches that are used to select the delays. The combination switch will determine a constant delay that is stored in the ROM table as a reference delay at this time. 

VHDL Codes































The line by line explanations of vhdl codes as follow:

  • Lines 1-4 is the definition of libraries used.
  • Lines 6-12 is the definition of I/O channels used. STOP is input channel for stopping leds flashing or all leds will turned off. DLY_OPT is used to select the time of delay that held in ROM tables called as romdelay. Q_LED is array channel outputs for driving 8 leds. CLK50MHZ as oscillator clock.
  • Line 16 is the definition of type_romdelay as integer in range 0 to 100000000 or 0 to 2 second.
  • Line 18 is the definition of dly and dly_buff variable as integer in range 0 to 100000000. dly for delay counter and dly_buff as comparing delay assign from romdelay table based on DLY_OPT.
  • Lines 21-27 is  the table of delay selections. 100000000 is 2 second, 50000000 is 1 second, 25000000 is 0.5 second, 12500000 is 0.25 second.
  • Lines 31-50 is the block of process. 
  • Lines 34-39, increment dly as delay counter, if same with dly_buff will read new delay from table, dly reset to zero, make toggle flag_blink.
  • Lines 41-49, turned on leds if STOP=0 and flag_blink=1, if not it leds will turned off.



YouTube Preview Image

Last updated by at .

Avatar of Bambang Siswoyo

About Bambang Siswoyo

I am a college lecturer since 1988 at UB (University of Brawijaya) in the electronics department. My experience: Applications of Microprocessor system, Applications of Control System, Applications of Field Programmable Gate Array, Computer Programming in computer instrumentations. My hobby: Music especially playing the saxophone, hiking and exploring the countryside.
This entry was posted in Electronics, fpga and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *



You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>