Shop OBEX P1 Docs P2 Docs Learn Events
7 segment LED question — Parallax Forums

7 segment LED question

ArchiverArchiver Posts: 46,084
edited 2003-10-22 07:17 in General Discussion
I am baffled by a programming question, maybe somebody here can send me in the
right direction.

I have a 7 segment LED driven through a 7447, which has 4 input lines.

And I have any good old number in a word in my program. What do I have to do to
get that number displayed on my 7 segment LED.

I guess first of all I should hock up a second display, one for each byte of the
word.
But then I need to extract the four bits of each byte and get them on my four
input lines of the 7447, but I don't know how.

TIA Uwe

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-10-21 13:40
    Set up a subroutine to generate the proper output for each character you
    want to show on the 7 segment display. You can look on the data sheet for
    the proper inputs if you don't know BCD. Then, call each subroutine as
    necessary to display the character you want. The subroutine should return
    to another that turns off the outputs to return the display to zero if that
    is what you want. Set up a board with LED's on the outputs and experiment
    until the proper outputs are on and you may understand a little better how
    it works.

    jim
    http://www.geocities.com/jimforkin2003/


    Original Message
    From: othello159 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=jNwy7adriXNKa48n5zQtYQgckuiqvdbcnyUjcDTXZpZQeRb8tyj3GVcxqWl23eCw4dg37m04rULV4fs65g]othello159@h...[/url
    Sent: Monday, October 20, 2003 11:25 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] 7 segment LED question


    I am baffled by a programming question, maybe somebody here can send me in
    the right direction.

    I have a 7 segment LED driven through a 7447, which has 4 input lines.

    And I have any good old number in a word in my program. What do I have to do
    to get that number displayed on my 7 segment LED.

    I guess first of all I should hock up a second display, one for each byte of
    the word.
    But then I need to extract the four bits of each byte and get them on my
    four input lines of the 7447, but I don't know how.

    TIA Uwe


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-21 13:48
    Othello,

    Once you have your word broken down into two bytes, you can acess the upper
    and lower nibble of each byte as:

    One_Byte var word
    upper_nib var nib
    lower_nib var nib

    to access the upper for bits

    upper_nib = One_Byte.highnib
    lower_nib = One_Byte.lownib

    Then if you have your 7 seg 4 input lines connected to the stamp pins 0 ~ 3
    and configured for outputs, for example you can then send out the data as: (I
    think when you say outa that will automatically make the pins output, somebody
    else chime in please).

    outa = lower_nib

    stamp pins 4 ~ 7 have the label outb

    outb = upper_nib

    Cheers,

    ken

    +++++++++++++++++++++++++++++
    I am baffled by a programming question, maybe somebody here can send me in
    the right direction.

    I have a 7 segment LED driven through a 7447, which has 4 input lines.

    And I have any good old number in a word in my program. What do I have to do
    to get that number displayed on my 7 segment LED.

    I guess first of all I should hock up a second display, one for each byte of
    the word.
    But then I need to extract the four bits of each byte and get them on my four
    input lines of the 7447, but I don't know how.


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-21 15:11
    You can save variable and code space by aliasing the nibbles like this:

    myNumber VAR Byte ' bcd value
    dig10 VAR myNumber.HIGHNIB ' 10's digit
    dig01 VAR myNumber.LOWNIB ' 1's digit


    The nibble declarations assume that the value stored in myNumber is BCD.
    If it isn't, then you have to declar them separately and extract with
    code. Like this:

    myNumber VAR Byte
    dig10 VAR Nib
    dig01 VAR Nib

    Get_Digits:
    dig10 = myNumber DIG 1
    dig01 = myNumber DIG 0


    As pointed out below, if your connections to the 7447 are clever [noparse][[/noparse]that
    is, aligned on the output nibbles] you can actually move your value to
    the display through a single line of code:

    Update_Digits:
    OUTL = myNumber


    To do this you would connect pins 0-3 to the 1's digit driver (A-D
    inputs), and connect pins 4-7 to the 10's digit driver.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office




    Original Message
    From: smartdim@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=FfqYT-YpJW1Iur1fBm_Yz9F1VPHN_mwYMaLoRGUoWm2QtlabJHeSmIKFZXASPXpPVpsgwU_n]smartdim@a...[/url
    Sent: Tuesday, October 21, 2003 7:48 AM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] 7 segment LED question


    Othello,

    Once you have your word broken down into two bytes, you can acess the
    upper
    and lower nibble of each byte as:

    One_Byte var word
    upper_nib var nib
    lower_nib var nib

    to access the upper for bits

    upper_nib = One_Byte.highnib
    lower_nib = One_Byte.lownib

    Then if you have your 7 seg 4 input lines connected to the stamp pins 0
    ~ 3
    and configured for outputs, for example you can then send out the data
    as: (I
    think when you say outa that will automatically make the pins output,
    somebody
    else chime in please).

    outa = lower_nib

    stamp pins 4 ~ 7 have the label outb

    outb = upper_nib

    Cheers,

    ken

    +++++++++++++++++++++++++++++
    I am baffled by a programming question, maybe somebody here can send me
    in
    the right direction.

    I have a 7 segment LED driven through a 7447, which has 4 input lines.

    And I have any good old number in a word in my program. What do I have
    to do
    to get that number displayed on my 7 segment LED.

    I guess first of all I should hock up a second display, one for each
    byte of
    the word.
    But then I need to extract the four bits of each byte and get them on my
    four
    input lines of the 7447, but I don't know how.


    [noparse][[/noparse]Non-text portions of this message have been removed]


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-22 06:02
    Thank you very much, I worked with the suggestions and now I have a two digit
    7-segment LED display.

    But I think I still will have to go back to the books because the display counts
    in hex.
    As Jon mentioned, the nibble value needs to be in BCD and I guess I did not
    understand how to get from a binary number stored in a nibble to a BCD
    representation.

    But everything else went well and with 8 pins gone for this display and 7 others
    for 3 individual A/D converters I will have to look into simplification.
    Changing the A/D converters for something like the TLC 2543 might give me back a
    number of pins but maybe someone here knows how to make the display more
    efficient, more numbers with less pins would be great.

    Thanks again

    Uwe






    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...> wrote:
    > You can save variable and code space by aliasing the nibbles like this:
    >
    > myNumber VAR Byte ' bcd value
    > dig10 VAR myNumber.HIGHNIB ' 10's digit
    > dig01 VAR myNumber.LOWNIB ' 1's digit
    >
    >
    > The nibble declarations assume that the value stored in myNumber is BCD.
    > If it isn't, then you have to declar them separately and extract with
    > code. Like this:
    >
    > myNumber VAR Byte
    > dig10 VAR Nib
    > dig01 VAR Nib
    >
    > Get_Digits:
    > dig10 = myNumber DIG 1
    > dig01 = myNumber DIG 0
    >
    >
    > As pointed out below, if your connections to the 7447 are clever [noparse][[/noparse]that
    > is, aligned on the output nibbles] you can actually move your value to
    > the display through a single line of code:
    >
    > Update_Digits:
    > OUTL = myNumber
    >
    >
    > To do this you would connect pins 0-3 to the 1's digit driver (A-D
    > inputs), and connect pins 4-7 to the 10's digit driver.
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    >
    >
    Original Message
    > From: smartdim@a... [noparse][[/noparse]mailto:smartdim@a...]
    > Sent: Tuesday, October 21, 2003 7:48 AM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] 7 segment LED question
    >
    >
    > Othello,
    >
    > Once you have your word broken down into two bytes, you can acess the
    > upper
    > and lower nibble of each byte as:
    >
    > One_Byte var word
    > upper_nib var nib
    > lower_nib var nib
    >
    > to access the upper for bits
    >
    > upper_nib = One_Byte.highnib
    > lower_nib = One_Byte.lownib
    >
    > Then if you have your 7 seg 4 input lines connected to the stamp pins 0
    > ~ 3
    > and configured for outputs, for example you can then send out the data
    > as: (I
    > think when you say outa that will automatically make the pins output,
    > somebody
    > else chime in please).
    >
    > outa = lower_nib
    >
    > stamp pins 4 ~ 7 have the label outb
    >
    > outb = upper_nib
    >
    > Cheers,
    >
    > ken
    >
    > +++++++++++++++++++++++++++++
    > I am baffled by a programming question, maybe somebody here can send me
    > in
    > the right direction.
    >
    > I have a 7 segment LED driven through a 7447, which has 4 input lines.
    >
    > And I have any good old number in a word in my program. What do I have
    > to do
    > to get that number displayed on my 7 segment LED.
    >
    > I guess first of all I should hock up a second display, one for each
    > byte of
    > the word.
    > But then I need to extract the four bits of each byte and get them on my
    > four
    > input lines of the 7447, but I don't know how.
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject
    > and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
    > This message has been scanned by WebShield. Please report SPAM to
    > abuse@p...
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-22 07:17
    Recovering pins is easy!!!!.........The BS2 has and instruction called
    SHIFTOUT. Using this command and two external ICs called a 74HC595, using just
    THREE
    stamp pins you can control 8, 16, 24, 32........48 output pins.
    The 74HC595 is a serial shift register. The Parallax web sight has the code
    and shows how to hook up one or two of these (exactly what you need "more
    numbers with less pins would be great). My suggestion would be to use the
    74hc595's to directly drive the two seven segment displays.


    See http://www.parallax.com/dl/docs/books/sw/exp/23b.pdf

    This explains the use and operation of the 595's and is well written.

    You can use a lookup table or other scheme to make the display show what you
    want.

    Ken




    Thank you very much, I worked with the suggestions and now I have a two digit
    7-segment LED display.

    But I think I still will have to go back to the books because the display
    counts in hex.
    As Jon mentioned, the nibble value needs to be in BCD and I guess I did not
    understand how to get from a binary number stored in a nibble to a BCD
    representation.

    But everything else went well and with 8 pins gone for this display and 7
    others for 3 individual A/D converters I will have to look into simplification.
    Changing the A/D converters for something like the TLC 2543 might give me back
    a number of pins but maybe someone here knows how to make the display more
    efficient, more numbers with less pins would be great.

    Thanks again

    Uwe


    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.