VHDL code to light up LED???

Discussion in 'VHDL' started by network lines, May 25, 2004.

  1. Hello...i am new to VHDL, and learning how to
    program using a Cypress CPLD.
    Anybody got some simple code to turn on and turn off
    an LED???
    please email sample code to

    TIA
     
    network lines, May 25, 2004
    #1
    1. Advertising

  2. network lines

    Jim Lewis Guest

    For active high:
    LedOut <= '1' ;

    For a simple on/off with a switch:
    LedOut <= SwitchIn ;

    Of course you probably should debounce the switch input
    and register the LedOut output. For debounce,
    do a search of the newsgroup. Assume that your
    switch is bouncing if it has not been stable for
    anywhere from 5 ms to 15 ms.

    If you bought your board, there may be a test
    code that your vendor provides that does this.

    Cheers,
    Jim

    network lines wrote:
    > Hello...i am new to VHDL, and learning how to
    > program using a Cypress CPLD.
    > Anybody got some simple code to turn on and turn off
    > an LED???
    > please email sample code to
    >
    > TIA



    --
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Jim Lewis
    Director of Training mailto:
    SynthWorks Design Inc. http://www.SynthWorks.com
    1-503-590-4787

    Expert VHDL Training for Hardware Design and Verification
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    Jim Lewis, May 26, 2004
    #2
    1. Advertising

  3. network lines

    Ray Andraka Guest

    If the switch just results in turning of and off a LED used as an
    indicator, there is no need to debounce it. Debounce becomes
    important if the fact that the switch turns on and off many times
    within a millisecond or so after it is actuated disturbs the
    operation of your circuit. Something like a counter that counts
    how many times the switch is operated would need debounce.
    Simply turning on and off the led to follow the switch movement
    does not.

    Likewise, dipswitches used to set modes often do not require
    debouncing. They can either be accepted as is, or in many cases
    are read at one particular instant during some initialization, so
    debounce is not needed. Only if the operation of the switch
    causes an immediate action is the debounce needed.

    Jim Lewis wrote:

    > For active high:
    > LedOut <= '1' ;
    >
    > For a simple on/off with a switch:
    > LedOut <= SwitchIn ;
    >
    > Of course you probably should debounce the switch input
    > and register the LedOut output. For debounce,
    > do a search of the newsgroup. Assume that your
    > switch is bouncing if it has not been stable for
    > anywhere from 5 ms to 15 ms.
    >
    > If you bought your board, there may be a test
    > code that your vendor provides that does this.
    >
    > Cheers,
    > Jim
    >
    > network lines wrote:
    > > Hello...i am new to VHDL, and learning how to
    > > program using a Cypress CPLD.
    > > Anybody got some simple code to turn on and turn off
    > > an LED???
    > > please email sample code to
    > >
    > > TIA

    >
    > --
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    > Jim Lewis
    > Director of Training mailto:
    > SynthWorks Design Inc. http://www.SynthWorks.com
    > 1-503-590-4787
    >
    > Expert VHDL Training for Hardware Design and Verification
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    --
    --Ray Andraka, P.E.
    President, the Andraka Consulting Group, Inc.
    401/884-7930 Fax 401/884-7950
    email
    http://www.andraka.com

    "They that give up essential liberty to obtain a little
    temporary safety deserve neither liberty nor safety."
    -Benjamin Franklin,
    1759
     
    Ray Andraka, May 26, 2004
    #3
  4. Jim Lewis wrote:
    > For active high:
    > LedOut <= '1' ;
    >
    > For a simple on/off with a switch:
    > LedOut <= SwitchIn ;


    Or save some fpga resources like this:

    VCC____/.-----[>|-----/\/\/--- GND


    http://home.comcast.net/~mike_treseler/rimshot.wav

    -- Mike Treseler
     
    Mike Treseler, May 26, 2004
    #4
  5. network lines

    Jim Lewis Guest

    My conservative suggestion to debounce is concern over
    noise causing the lifetime of the LED to be shorter.
    Perhaps this is not a concern?

    I know in my house some light bulbs seem to burn out
    faster than others and I have always wondered if it
    was due to excessive noise from the switches (look
    nice, but knowing the builder they are probably
    low cost).

    Cheers,
    Jim



    > If the switch just results in turning of and off a LED used as an
    > indicator, there is no need to debounce it. Debounce becomes
    > important if the fact that the switch turns on and off many times
    > within a millisecond or so after it is actuated disturbs the
    > operation of your circuit. Something like a counter that counts
    > how many times the switch is operated would need debounce.
    > Simply turning on and off the led to follow the switch movement
    > does not.
    >
    > Likewise, dipswitches used to set modes often do not require
    > debouncing. They can either be accepted as is, or in many cases
    > are read at one particular instant during some initialization, so
    > debounce is not needed. Only if the operation of the switch
    > causes an immediate action is the debounce needed.
    >
    > Jim Lewis wrote:
    >
    >
    >>For active high:
    >> LedOut <= '1' ;
    >>
    >>For a simple on/off with a switch:
    >> LedOut <= SwitchIn ;
    >>
    >>Of course you probably should debounce the switch input
    >>and register the LedOut output. For debounce,
    >>do a search of the newsgroup. Assume that your
    >>switch is bouncing if it has not been stable for
    >>anywhere from 5 ms to 15 ms.
    >>
    >>If you bought your board, there may be a test
    >>code that your vendor provides that does this.
    >>
    >>Cheers,
    >>Jim
    >>
    >>network lines wrote:
    >>
    >>>Hello...i am new to VHDL, and learning how to
    >>>program using a Cypress CPLD.
    >>>Anybody got some simple code to turn on and turn off
    >>>an LED???
    >>>please email sample code to
    >>>
    >>>TIA

    >>
    >>--
    >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    >>Jim Lewis
    >>Director of Training mailto:
    >>SynthWorks Design Inc. http://www.SynthWorks.com
    >>1-503-590-4787
    >>
    >>Expert VHDL Training for Hardware Design and Verification
    >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    >
    >
    > --
    > --Ray Andraka, P.E.
    > President, the Andraka Consulting Group, Inc.
    > 401/884-7930 Fax 401/884-7950
    > email
    > http://www.andraka.com
    >
    > "They that give up essential liberty to obtain a little
    > temporary safety deserve neither liberty nor safety."
    > -Benjamin Franklin,
    > 1759
    >
    >



    --
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Jim Lewis
    Director of Training mailto:
    SynthWorks Design Inc. http://www.SynthWorks.com
    1-503-590-4787

    Expert VHDL Training for Hardware Design and Verification
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    Jim Lewis, May 26, 2004
    #5
  6. network lines

    Symon Guest

    Hi Jim,
    I don't think it matters mate. I know almost all the 7 segment LED displays
    I've seen, e.g. on frequency counters, are multiplexed. Thus they're
    flashing on and off 'faster than the human eye'! You can see this if you
    snort like a pig while watching them! Honest! It's something to do with the
    snort vibrating your head.
    Cheers, Syms.
    "Jim Lewis" <> wrote in message
    news:...
    > My conservative suggestion to debounce is concern over
    > noise causing the lifetime of the LED to be shorter.
    > Perhaps this is not a concern?
    >
    > I know in my house some light bulbs seem to burn out
    > faster than others and I have always wondered if it
    > was due to excessive noise from the switches (look
    > nice, but knowing the builder they are probably
    > low cost).
    >
    > Cheers,
    > Jim
     
    Symon, May 26, 2004
    #6
  7. network lines

    paris Guest

    "Jim Lewis" <> escribió en el mensaje
    news:...
    > My conservative suggestion to debounce is concern over
    > noise causing the lifetime of the LED to be shorter.
    > Perhaps this is not a concern?
    >
    > I know in my house some light bulbs seem to burn out
    > faster than others and I have always wondered if it
    > was due to excessive noise from the switches (look
    > nice, but knowing the builder they are probably
    > low cost).
    >
    > Cheers,
    > Jim
    >


    actually i think it's because of the light bulb being turned on when the
    electric current sinus feeding it is not zero or near zero volts, which
    causes stress on the bulb filament (the thin tunsgten wire that lights)
    LEDs being solid state devices (and using a different light emitting
    pheanomenon than bulbs), i dont think they have this problem

    >
    >
    > > If the switch just results in turning of and off a LED used as an
    > > indicator, there is no need to debounce it. Debounce becomes
    > > important if the fact that the switch turns on and off many times
    > > within a millisecond or so after it is actuated disturbs the
    > > operation of your circuit. Something like a counter that counts
    > > how many times the switch is operated would need debounce.
    > > Simply turning on and off the led to follow the switch movement
    > > does not.
    > >
    > > Likewise, dipswitches used to set modes often do not require
    > > debouncing. They can either be accepted as is, or in many cases
    > > are read at one particular instant during some initialization, so
    > > debounce is not needed. Only if the operation of the switch
    > > causes an immediate action is the debounce needed.
    > >
    > > Jim Lewis wrote:
    > >
    > >
    > >>For active high:
    > >> LedOut <= '1' ;
    > >>
    > >>For a simple on/off with a switch:
    > >> LedOut <= SwitchIn ;
    > >>
    > >>Of course you probably should debounce the switch input
    > >>and register the LedOut output. For debounce,
    > >>do a search of the newsgroup. Assume that your
    > >>switch is bouncing if it has not been stable for
    > >>anywhere from 5 ms to 15 ms.
    > >>
    > >>If you bought your board, there may be a test
    > >>code that your vendor provides that does this.
    > >>
    > >>Cheers,
    > >>Jim
    > >>
    > >>network lines wrote:
    > >>
    > >>>Hello...i am new to VHDL, and learning how to
    > >>>program using a Cypress CPLD.
    > >>>Anybody got some simple code to turn on and turn off
    > >>>an LED???
    > >>>please email sample code to
    > >>>
    > >>>TIA
    > >>
    > >>--
    > >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    > >>Jim Lewis
    > >>Director of Training mailto:
    > >>SynthWorks Design Inc. http://www.SynthWorks.com
    > >>1-503-590-4787
    > >>
    > >>Expert VHDL Training for Hardware Design and Verification
    > >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    > >
    > >
    > > --
    > > --Ray Andraka, P.E.
    > > President, the Andraka Consulting Group, Inc.
    > > 401/884-7930 Fax 401/884-7950
    > > email
    > > http://www.andraka.com
    > >
    > > "They that give up essential liberty to obtain a little
    > > temporary safety deserve neither liberty nor safety."
    > > -Benjamin Franklin,
    > > 1759
    > >
    > >

    >
    >
    > --
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    > Jim Lewis
    > Director of Training mailto:
    > SynthWorks Design Inc. http://www.SynthWorks.com
    > 1-503-590-4787
    >
    > Expert VHDL Training for Hardware Design and Verification
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    paris, May 26, 2004
    #7
  8. network lines

    Ray Andraka Guest

    LEDs don't burn out due to turn on/off. In fact, a common way of
    varying the brightness in LED displays is to pulse width modulate the
    driving voltage.

    Light bulbs burn out faster on turn on/off cycles because the wire
    resistance is lower when it is cold, and when turned on it has a surge
    of current much higher than the on current. LEDs are a different
    mechanism for producing the light. I doubt that noise on the switch is
    going to alter incadesant lamp life much, the on-off cycles are way to
    fast to get the shock heating that happens when you turn them on.


    Jim Lewis wrote:

    > My conservative suggestion to debounce is concern over
    > noise causing the lifetime of the LED to be shorter.
    > Perhaps this is not a concern?
    >
    > I know in my house some light bulbs seem to burn out
    > faster than others and I have always wondered if it
    > was due to excessive noise from the switches (look
    > nice, but knowing the builder they are probably
    > low cost).
    > --
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    > Jim Lewis
    > Director of Training mailto:
    > SynthWorks Design Inc. http://www.SynthWorks.com
    > 1-503-590-4787
    >
    > Expert VHDL Training for Hardware Design and Verification
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    --
    --Ray Andraka, P.E.
    President, the Andraka Consulting Group, Inc.
    401/884-7930 Fax 401/884-7950
    email
    http://www.andraka.com

    "They that give up essential liberty to obtain a little
    temporary safety deserve neither liberty nor safety."
    -Benjamin Franklin, 1759
     
    Ray Andraka, May 27, 2004
    #8
  9. network lines

    Symon Guest

    Indeed, but it's not the excess turn on current per se that blows the bulb,
    it's the thermal stress on the filament which expands as it heats up. The
    lower filament resistance at cold means it heats up faster than it would if
    the resistance stayed constant. There are stories of light bulbs in fire
    stations that are permanently on that last for many decades.
    check out http://www.firehouse.com/news/2001/6/11_bulb.html . 100 years and
    still going.
    cheers, Syms.
    "Ray Andraka" <> wrote in message
    news:...
    > Light bulbs burn out faster on turn on/off cycles because the wire
    > resistance is lower when it is cold, and when turned on it has a surge
    > of current much higher than the on current.
     
    Symon, May 27, 2004
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flemming Hansen

    LED decoder with CoolRunner II

    Flemming Hansen, Jan 9, 2006, in forum: VHDL
    Replies:
    5
    Views:
    1,659
    Mike Treseler
    Jan 23, 2006
  2. Replies:
    1
    Views:
    578
    Chris Lambacher
    Jul 31, 2006
  3. =?iso-8859-1?q?J=FCrgen_Gerstacker?=

    A swing/awt component that looks like a LED

    =?iso-8859-1?q?J=FCrgen_Gerstacker?=, Dec 15, 2006, in forum: Java
    Replies:
    2
    Views:
    1,170
    =?iso-8859-1?q?J=FCrgen_Gerstacker?=
    Dec 17, 2006
  4. deelok
    Replies:
    0
    Views:
    1,045
    deelok
    Oct 26, 2007
  5. willmann817
    Replies:
    5
    Views:
    520
Loading...

Share This Page