Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Clock with BS2? — Parallax Forums

Propeller Clock with BS2?

houserhouser Posts: 4
edited 2005-01-04 21:07 in BASIC Stamp
Hello everyone,
I am realtively new to stamps and have started a perhaps doomed project. As a first practical project I have started to try and construct Bob Blick's "Propeller Clock" .

More information can be found at:
··· http://www.bobblick.com/techref/projects/propclock/propclock.html

The clock uses a persistence (sp?) of vision to display messages or the time on a spinning array of LEDs. Items like this are starting to appear in retail stores, InfoGlobe being one that I have personally seen at Radio Shack and the Discovery Channel store.

Bob's original and most copies I have found use a PIC. My version, with the BS2 and a temporary "propeller" made from Legos seems to have one major flaw (o.k. there might be more than one :-). The stamp does not seem fast enough to display the digits as the propeller flings by.

I have LED's wired to the low order IO pins and with the following code I can get a "reasonable" 2. Note there is no pause in-between each "scan line".

Show2:
· LEDs = $21
· LEDs = $43
· LEDs = $45
· LEDs = $49
· LEDs = $31
· LEDs = $00
· RETURN

This gives a clean
· ***
·*··· *
····· *
··· *
· *
·*****

If I use a loop (reading data from eeprom) as in the following code:

ShowDigit:
· ' Compute the starting index of this digit's data
· startLoc = (5 * Digit) + Zero
· endLoc·· = startLoc + 5
· FOR DigitIndex = startLoc TO endLoc
··· READ DigitIndex, DigitByte
··· LEDs = DigitByte
· NEXT
· LEDs = $0000
· RETURN

Then my 2 is "squished" or drawn out, as in the time to display the "scan line" is about 4 to 5 times too slow. So this gives a (poor representation);

· ************
·****·············· ****
·············· ****
······· ****
· ****
·*************


Am I simply trying to do something here that is not well suited to the stamp -- and would be better off reverting to a (raw) PIC if I continue?

Thanks

·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-06 00:16
    In addtion to your data, the BS2 has to do instruction fetches and decoding from an external EEPROM which takes a LONG time in microcontroller terms. So, this may not be the best project for a BS2. If you really want to do this, then you could move that code -- with little modification -- to an SX28 using our free SX/B compiler (which comes with the SX-Key programming tool).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2004-12-06 01:05
    If you are determined to use the BASIC Stamp for this project, there are alternative ways to do the programming to make it run faster. Whether it can be made "fast enough" is a challenge. The straight assignment statements in your first example take only 200 microseconds each, so you finish the loop of 6 states in under 2 milliseconds. Visual fusion takes repetition at a rate of 20 hertz or faster, so the available time to refresh your display is 50 milliseconds or less.

    However, in your next example there is a lot more going on. FOR-NEXT loops are particularly slow in PBASIC--Each iteration of the loop can take 700 or 800 microseconds. READ is also relatively slow, taking about 500 microseconds each. It all adds up, and fast.

    You might have better luck with a separate subroutine to display each digit straight out, like your first example. Your main program loop would call the straight-through for speed subroutines.

    A BS2p would be better suited to this task too, better suited than a plain BS2, for a couple of reasons. First, it is over three times faster in executing instructions. Second, it has a lot more eeprom, where you could store patterns. Third, it has a "POLLWAIT" command that would be just the ticket for synchronizing the display with top dead center.

    All that being said, I agree with others that a faster chip running assembly language or SX/B would best suited to this task as you need to add more features. Making it work and designing it around a Stamp is a good challenge though!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • houserhouser Posts: 4
    edited 2004-12-06 02:52
    Thanks for the quick replies. I have been arriving at the same conclusion - that the BS2 just was not the right part for the project. Unfortunately those are the parts I·have·on hand at present.

    Thank you for your suggestions on the SX products. I will investigate further along those lines. Or perhaps choose a better suited project. (one that is less time critical). I think there is a 2p in my stash may mitigate the problem some.

    I may still try and make a go with the BS2, but no longer have any hopes of great success. I have been experimenting with a subroutine for each digit (as the second reply mentions). This has given reasonable, but not elegant results.

    I have also concluded that there does need to be a sensor to indicate Top Dead Center, as I cannot "time" the loop well enough by trial and error. With the added problems of keeping the propeller motor at a constant speed.

    The clock project is very interesting. If you have not had a look, you should take a click over.

    Stephen.


    Post Edited (houser) : 12/6/2004 3:02:34 AM GMT
  • BeanBean Posts: 8,129
    edited 2004-12-06 03:34
    Just curious, how are you controlling the motor speed ?

    As others have said, if you really want to make this project, SX/B is a perfect fit. But if you are looking for a challange, the BS2 is certainly one. You may have to limit how many characters you can display.

    Do you have a deadline for the project ?

    Let me know if you decide to try SX/B I can help.

    Bean.
  • houserhouser Posts: 4
    edited 2004-12-06 15:43
    I am *not* controlling motor speed. Hence the need to indicate/locate top dead center and base display from there. Perhaps "base display from then" would be more appropriate wording.

    It seems it would be more effort (and more circuitry) to actually control the motor speed, with feedback, to get the timing proper. By letting it free spin and just knowing when I hit TDC saves a bit of work.
  • robocutrobocut Posts: 15
    edited 2005-01-04 09:33
    Hello!

    We built a 8-LED STAMP powered "Prope
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-01-04 15:57
    Robocut,

    ·· Ended up checking out other stuff on the site, and realized I just spent a bunch of time watching a video about Robocut, even though I couldn't understand the language.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • MikeSMikeS Posts: 131
    edited 2005-01-04 20:57
    Robocut,

    I like the project. Any chance of schematics and documentation in English?

    In you example code you have "pause 0". Is this a special case for the pause command? I have never encountered it before.
  • houserhouser Posts: 4
    edited 2005-01-04 21:07
    I have made a little more progress on my version.

    http://stephenhouser.com/software/propeller_clock.html

    Has a bit of text, click on the photo to see more photos. I'll upload some more recent ones this evening.

    I have ended up using something like the following (so far).

    ...
    ··DigitToShow = 5
    ··GOSUB ShowDigitBranch
    ...

    ShowDigitBranch:
    ··BRANCH DigitToShow, [noparse][[/noparse]Show0, Show1, Show2, Show3, Show4, Show5, Show6, Show7, Show8, Show9, ShowColon]
    ··RETURN ' never get here

    Show0:
    ··LEDs = $3e
    ··LEDs = $41
    ··LEDs = $41
    ··LEDs = $41
    ··LEDs = $41
    ··LEDs = $3e
    ··RETURN

    This has helped the timing.

    I have also modified the "lego" propeller parts, I should have more photos tomorrow of the current state of prototype.

    ·
Sign In or Register to comment.