Shop OBEX P1 Docs P2 Docs Learn Events
99-0 countdown using seven segment display — Parallax Forums

99-0 countdown using seven segment display

ndupuyndupuy Posts: 1
edited 2013-09-03 20:03 in BASIC Stamp
I have an assignment in which I have to make a seven segment display with two digits count down from 99 using subroutines.

This is the exact assignment:

Your assignment is to write a new program using subroutines to display numbers 0-9 on each digit of the 7-segment display. In total, you will need 21 subroutines: 0-9 for digit 1, 0-9 for digit 2, and a reset subroutine which turns off all segments. Once all the subroutines are created, you can easily count down from higher numbers. Create these subroutines and program the Boe-Bot to count down from 99 to 0.

I have made all of the subroutines, but do not know how to apply them to make a countdown. I am using bs2 and language 2.5.
I have attached what I have so far

Any help would be appreciated

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-09-03 20:03
    I don't want to take all the fun out of this for you so I'll just try to offer some hints.

    I don't use the BS2 much myself but when I opened your program, I could see a list of demo programs in one of the left panes of the editor. The program "ON-GOSUB.BS2" caught my attention. After looking at the program, I'm pretty sure it supplies a pretty good example of what you want to do.

    Here's another hint. I wrote some variables which I think would be helpful in your program.
    ' {$STAMP BS2}' {$PBASIC 2.5}
    
    
    tens            VAR     Byte
    units           VAR     Byte
    CountDown       VAR     Byte
    COUNT_FROM      CON     99
    

    I think you should remove all the "PAUSE" statements from the subroutines and just use one "PAUSE" in your main loop.

    Hopefully the above will give enough to get you started looking in the right directions.
Sign In or Register to comment.