Shop OBEX P1 Docs P2 Docs Learn Events
Project bikecomputer: multiple 7 segment displays — Parallax Forums

Project bikecomputer: multiple 7 segment displays

PlaneTeeRPlaneTeeR Posts: 100
edited 2006-01-30 17:50 in Learn with BlocklyProp
hello,

I'm starting a project on my school called bikecomputer.
Here I have to develope a computer to show te speed and show the distance and so on..
I'm building it on a board of eduction·with a javalin stamp.

For this project i'm displaying the speed and distance on 7 segment displays (minimum of 3)!

The board had 15 I/O ports, how can i connect those 3, 7 segment displays and use them?

Sorry voor my bad english

Thanks Johnny
Holland

Comments

  • John AstralidisJohn Astralidis Posts: 28
    edited 2006-01-26 14:32
    Hi !

    I've started a thread in "Basic Stamp" forum titled: "Adding a speedometer in my BoeBot". Guys that replied gave me an idea of what is possible to do. Check it out, if you can find anything that could help you, too.

    Cu.

    John.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-26 16:18
    This Stampworks exercise should help you to figure out how to·drive multiplexed 7 segement LEDs: http://www.parallax.com/dl/docs/books/sw/exp/sw10.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • PlaneTeeRPlaneTeeR Posts: 100
    edited 2006-01-26 16:43
    I've seen that, yes it helped me a little bit further.
    I've now connected 2 7 segment displays on my board for testing.
    But when i read that code thats been made i don't understand how the do it.
    I've got the technical part but don't understand te software part.

    thanks

    Johnny
    Holland
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-26 17:10
    I can help explain the gist of the software after my two phone interviews scheduled today (after about 4PM (GMT -5)).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • PlaneTeeRPlaneTeeR Posts: 100
    edited 2006-01-26 18:27
    Thanks, but i think i'm going with a bcd to control multiple LED.


    Johnny
    Holland
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-26 18:29
    BCD is only a method of encoding decimals in binary, it doesn't help you in how to drive the segments, a little patience (in 2 1/2 hours), and Ill strip out all the clock portions of the example and show you the bare essentials of being able to drive the segments with any arbitrary number (which will likely be in BCD).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-26 21:08
    Ok the interviews concluded earlier than expected,

     
     
    ' {$STAMP BS2}
    
     
    ' ------------------------------------------------------------------------------
    ' Program Description:
    
    ' This program displays a a 4 digit number on a 4 7 segment LED display
     
    ' ------------------------------------------------------------------------------
    ' I/O Definitions
    ' ------------------------------------------------------------------------------
    Segs   VAR OutL ' segments
    DigSel VAR OutC ' digit select
    
     
    ' ------------------------------------------------------------------------------
    ' Constants
    ' ------------------------------------------------------------------------------
    DecPoint CON %10000000 ' decimal point bit
    Blank    CON %00000000 ' all segments off
    
    Dig0     CON %1111 ' digit select control
    Dig1     CON %1110
    Dig2     CON %1101
    Dig3     CON %1011
    Dig4     CON %0111
     
    ' ------------------------------------------------------------------------------
    ' Variables
    ' ------------------------------------------------------------------------------
    value VAR Nib(4) ' value to be displayed
    digit VAR Nib    ' current display digit
    
    ' ------------------------------------------------------------------------------
    ' EEPROM Data
    ' ------------------------------------------------------------------------------
    ' .abcdefg
    ' --------
    DecDig DATA %01111110 ' 0
           DATA %00110000 ' 1
           DATA %01101101 ' 2
           DATA %01111001 ' 3
           DATA %00110011 ' 4
           DATA %01011011 ' 5
           DATA %01011111 ' 6
           DATA %01110000 ' 7
           DATA %01111111 ' 8
           DATA %01111011 ' 9
    
    ' ------------------------------------------------------------------------------
    ' Initialization
    ' ------------------------------------------------------------------------------
    Initialize:
       DirL = %11111111 ' make segments outputs
       DirC = %1111 ' make digit selects outputs
       DigSel = Dig0 ' all digits off
    
    ' ------------------------------------------------------------------------------
    ' Program Code
    ' ------------------------------------------------------------------------------
    Main:
       GOSUB Show_Time ' show current digit
    
    
       ' additional code could go here
       GOTO Main 'do it again
    END
     
    ' ------------------------------------------------------------------------------
    ' Subroutines
    ' ------------------------------------------------------------------------------
    Show_Digit:
    
       Segs = Blank ' clear display
       ' enable digit
       LOOKUP digit, [noparse][[/noparse]Dig1, Dig2, Dig3, Dig4], digSel
       READ (DecDig + value(digit)), Segs ' put segment pattern in digit
       PAUSE 1 ' show it
       digit = (digit + 1) // 4 ' get next digit
    RETURN
    

    Ok this code should work for any 4 digit value stored in the array "value". DecDig is the illumination pattern for each of the digits 0-9. Each time the Show_Digit subroutine is called, it displays the next digit on the next LED. The first line resets the segments (turns them all off), the LOOKUP command activates the next segment for displaying it's digit, the READ command looks up the illumination pattern for the new digit by fetching the value at the base address of the illumination map plus the value of the digit to be displayed and updates the value output to the segment, finally the digit is incremeted with wrap around for the next time Show_Digit is called.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-26 21:14
    Sorry I didn't catch this discussion earlier -- you can get the explanation for that code from StampWorks 2.0 (though Paul did a great job, as always):

    http://www.parallax.com/detail.asp?product_id=27220

    You will note that I explain this is simply to demonstrate multiplexing only, and that it's really not appropriate to integrate into programs that require a lot of other work going on.· I think you'll get very poor display results from this once you start trying to read the bicycle's speed.· But... there is a chapter later in the book that shows how to interface to the MC14489 (costs a few dollars) and let you display what you want without having to do the multiplexing yourself.· I also wrote about this chip in Nuts & Volts:

    http://www.parallax.com/dl/docs/cols/nv/vol6/col/nv127.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-26 21:33
    Thanks Jon, I forgot to mention that the code only suitably works for very light coding in the "' additional code could go here" section. For heavy coding you should use an additional chip to do the LED segment driving grunt work for you like the one Jon suggests.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • LejgeoLejgeo Posts: 8
    edited 2006-01-27 03:45
    why not use a cd display instead, thats what they use on pro speedometers...
  • PlaneTeeRPlaneTeeR Posts: 100
    edited 2006-01-30 16:05
    Jon Williams·said...

    Sorry I didn't catch this discussion earlier -- you can get the explanation for that code from StampWorks 2.0 (though Paul did a great job, as always):

    http://www.parallax.com/detail.asp?product_id=27220

    You will note that I explain this is simply to demonstrate multiplexing only, and that it's really not appropriate to integrate into programs that require a lot of other work going on.· I think you'll get very poor display results from this once you start trying to read the bicycle's speed.· But... there is a chapter later in the book that shows how to interface to the MC14489 (costs a few dollars) and let you display what you want without having to do the multiplexing yourself.· I also wrote about this chip in Nuts & Volts:

    http://www.parallax.com/dl/docs/cols/nv/vol6/col/nv127.pdf

    Hey Jon,

    Sorry for my late reaction.

    As I mentioned before, I'm working with the Javalin stamp. Will this chip do better or is it still to slow to get good results with multiplexing? I don't think so myself, so i'm going to find a source for that motorola chip. Thanks for the advise, and hopefully i can figure it out in Java :P.

    Johnny Kuiper
    Holland
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-30 16:25
    Well, there is no multiplexer VP in the Javelin so I think using the MC14489 would still be a benefit; that will let your Javelin program focus on the sensor input and measurement calculations.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • PlaneTeeRPlaneTeeR Posts: 100
    edited 2006-01-30 17:22
    Oke thanks for the advise again. Can I take your recommendation into my rapport?

    offtopic:
    Will there be more javalin example's in the future?

    Johnny Kuiper
    Holland
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-30 17:37
    I don't know the future of the Javelin -- it's not a big seller right now, seems pretty stable, and we don't get many requests for changes. We work like any other company: when we get a lot of requests for something new/updated, we respond.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • PlaneTeeRPlaneTeeR Posts: 100
    edited 2006-01-30 17:50
    Ah Oke,

    Well our school went from Basic to Javalin, because we also have intensive Java programming.
    We will see what the future brings...

    When I finish this project, I will send it to you...

    Johnny Kuiper
    Holland
Sign In or Register to comment.