Shop OBEX P1 Docs P2 Docs Learn Events
HELP plz Basic stamp seven segment display question: Student — Parallax Forums

HELP plz Basic stamp seven segment display question: Student

jeffpopsjeffpops Posts: 12
edited 2013-02-20 11:48 in BASIC Stamp
Writing a program to run 3 seven segment displays to count from 0-999 in 10 seconds! My wiring is gotta br right bc i checked it/built it several times. Pic below:

My code i have wrote may be the problem. Pic below..

Can someone please help me see what im doing wrong or ill get no sleep tonight.. ha thanks

Code i wrote:

' {$STAMP BS2}
' {$PBASIC 2.5}

DIRS=%111111111111

hundredscounter VAR Byte
tenscounter VAR Byte
counter VAR Byte

OUTC=%0000
FOR hundredscounter= 1 TO 9
OUTB=%0000
FOR tenscounter = 1 TO 9
OUTA=%0000
FOR counter = 1 TO 9
OUTA=OUTA+1
PAUSE 10
NEXT
OUTB=OUTB+1
PAUSE 10
NEXT
OUTC=OUTC+1
PAUSE 10
NEXT
END
1024 x 575 - 127K

Comments

  • jeffpopsjeffpops Posts: 12
    edited 2013-02-18 23:01
    Also im using 3 7447's wired to the displays w proper resistors
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-19 06:56
    You didn't say what's happening wrong. If the timing is wrong, you might try putting a "PAUSE 10" after the "OUTA=%0000" so the 0 gets to display about the same time as the other digits and you have 100ms per cycle. Try commenting out the "PAUSE 10" statements for the other digits. You don't need them since the units delays allow the digits to be seen and the digits "tick" is your real time standard.

    You may need to adjust the "PAUSE 10" delays. The Basic statements themselves take a little time to execute and that will cause the whole thing to take longer than the 10 seconds you want.
  • jeffpopsjeffpops Posts: 12
    edited 2013-02-19 09:33
    Hey thx for the response, my segments r not blinking correctly, I tired but connecting the Counter Var Byte command, to the 7447 to segement alone to see if i can get it to blink from 0-9 and its all out of order with 6 and 7 messed up..

    Tried to single out this command to my display and its still not working right!

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    DIRS=%111111111111
    OUTA=%0000
    FOR counter = 1 TO 9
    OUTA=OUTA+1
    PAUSE 10
    NEXT
    END
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-19 09:54
    With the loop as you've written it, the whole count up from 0 to 9 will zip by in about 1/10 second. You really won't see it.

    If the segments are not lighting up correctly, then you must have some sort of wiring error around the 7447s. Check your wiring carefully. Draw a schematic from the actual wiring (not what you think it should be), scan it in, and post it here as an attachment. The photo doesn't show the wiring well enough.
  • jeffpopsjeffpops Posts: 12
    edited 2013-02-19 10:04
    ok i slowed it down to see what was blinking and can post what i found, i will also draw a schematic of how its wired rt now.. b back in 30min
  • jeffpopsjeffpops Posts: 12
    edited 2013-02-19 10:52
    With only the one segment wired the numbers are blinking in this order: 1 8 9 4 5 then this is where it gets messed up, segments f,g,h are lite up, then a,f,g, and d are lite up, then 2 3 end... so im missing 6 and 7 and cant understand why this is happening. I slowed down the program to see this happening. this is my code. if i cant get the one segment to work correctly getting all 3 in sync is looking grim at the moment.. schematic on its way

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    DIRS=%11111111
    counter VAR Byte
    OUTA=%00000000
    FOR counter = 1 TO 9
    OUTA=OUTA+1
    PAUSE 3000
    NEXT
    END
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-19 11:05
    The least significant bit of OUTA is I/O pin #0 (usually labelled P0). That would correspond to A0 on the 7447. Similarly, the next bit of OUTA is I/O pin #1 (P1) which would correspond to A1 on the 7447 and so on. You probably have the 7447 wired incorrectly.
  • jeffpopsjeffpops Posts: 12
    edited 2013-02-19 11:06
    this is a drawing how i have my one 7447 wired to a seven segment display. trying to get it to count from 0-9 and its all outta order and dont get it
    1024 x 1823 - 140K
  • jeffpopsjeffpops Posts: 12
    edited 2013-02-19 11:09
    once i can get this to go from 0-9 i wanna sync the other 2 so itll count from 0-999
  • jeffpopsjeffpops Posts: 12
    edited 2013-02-19 16:21
    Figured it out when i got to class. had the i/o's not in the right spots. thx for the help
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-19 21:28
    On the 7447, the An pins are not in the order you'd expect and you had them wired to the wrong Stamp I/O pins.

    In situations like this one, I always painstakingly go and compare the datasheet diagram with a hand drawn schematic made from the actual wiring. Sometimes it helps to have someone else do the comparison since we "know" what the wiring is supposed to be. One of the signs of a really good programmer is the ability to look at a piece of code that you've written and really look at it as if someone else had written it. Same thing is true for hardware.
  • jeffpopsjeffpops Posts: 12
    edited 2013-02-20 11:48
    k cool, thanks mike
Sign In or Register to comment.