Shop OBEX P1 Docs P2 Docs Learn Events
Countdown timer? — Parallax Forums

Countdown timer?

VaatiVaati Posts: 712
edited 2009-05-15 22:44 in Propeller 1
Is it possible to make a countdown timer with the Prop written in Spin?· If so, how?· All of the timer objects I have tried either don't output on tv, require a keyboard/mouse, or are made to work on·the HYDRA...

Thanks. smurf.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
«1

Comments

  • JomsJoms Posts: 279
    edited 2009-05-13 22:25
    Take a look at this object in the OJEX.· I have used it a few times.· It is actually a count up but I suppose it can be modifed to count down.· It is a place to start anyways...

    http://obex.parallax.com/objects/45/
  • VaatiVaati Posts: 712
    edited 2009-05-13 22:29
    Hmmm... Yes, I did see that... But, I don't have a 4x20 serial lcd, just a tv... Could that program be modified to output on a tv instead?

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-13 22:31
    You've got a bunch of separate issues here.

    1) Making a countdown timer ... What is it counting down? Seconds? Hundreths of a second? What?

    2) Displaying time, specifically the count in the timer ... What do you want to display? How large? On what kind of display device? (You mentioned a TV. Is that it?)

    Yes, of course it's possible to make a countdown timer. It could be done entirely in Spin as long as you're counting milliseconds or multiples of milliseconds.

    How? By programming the parts of the project, one at a time. The existing graphics driver can scale up characters pretty large. You do have to clear the area of the display used. You can't just write new characters. They don't erase what's underneath. The cycle is "clear the area for the digits", "write a new number". You probably will need to write your own formatting routine to add colons and a decimal point where you need it. You probably don't want to suppress leading zeros (which the standard decimal output routine does.
  • VaatiVaati Posts: 712
    edited 2009-05-13 22:41
    Okay, sorry for the lack of details. What I am leading up to is an Ebay clock. In theory, the Ebay clock will have a list of items that you're watching/bidding on. This list is edited via an NES controller by selecting the letters, etc. The time the item was posted is then entered, as well as the current time. Then, it does the math to see how much time is left for the auction and displays it in the item menu.

    That pretty much sums it up. It would only need to count seconds, but the timer would need to be accurate enough to be close to the actual auction end time of a 30 day listing. I do have a 5.00 MHz xtal, so...

    So, is it still possible... ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • SciNemoSciNemo Posts: 91
    edited 2009-05-13 23:08
    It's possible, but to address some issues:

    You don't need to find an object that counts down and supports displaying to a screen at the same time. All you need is a television driver object. The rest can be done in the main program code.

    You don't need a counter object, because you can pull the time left until the end auction right off the computer you are using to access the internet (which I am assuming you are doing).

    Other than that, good luck with the project, sounds like a really useful device.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Not the fish.
    sites.google.com/site/bitwinproject/
  • VaatiVaati Posts: 712
    edited 2009-05-13 23:22
    SciNemo said...

    You don't need a counter object, because you can pull the time left until the end auction right off the computer you are using to access the internet (which I am assuming you are doing).
    Hmmm...· Please explain what you mean by pulling the time left right off the computer.· That sounds like it would require the PINK or something of the sort...· ?

    Thanks. smurf.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-13 23:37
    You will have problems with accuracy over a 30 day period. Most crystals that are at a stable temperature are accurate only to about 1/2 second per day (6 ppm). With temperature variations, this is even greater. If the error accumulates, that could be 1/2 minute per month.

    You may need a temperature compensated clock oscillator and further manually calibrate it against something like the WWV time standard by letting it run over a month and note the count your clock thinks it is vs. the elapsed time via WWV and adjust for the difference in your program.
  • VaatiVaati Posts: 712
    edited 2009-05-13 23:39
    I know, except that isn't an online program-- it's an actual alarm clock that doesn't require you to turn on your computer to see how much time is left on one of your watched items. I did look at that program before, but I would think that this would be a nice alternative for things that you might have an interest in, but don't necessarily want to bid on.
    Alas, what I really need is code. So, what sort of code would be needed to do what I described in my previous post?

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • VaatiVaati Posts: 712
    edited 2009-05-13 23:44
    Ouch... Well, maybe I could write it so 30-day auctions can be entered only within 5 days of the end time.... But, that would be compensating user-friendliness for functionality... Tough choice...

    Also, I am terrible with three letter acronyms. What in the world does WWV stand for?

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • kwinnkwinn Posts: 8,697
    edited 2009-05-14 01:08
    Use the 60Hz AC from a transformer connected to the power line and count the cycles. Long term accuracy is very good as long as there are no power outages. A 4-12V output with a diode and 47K resistor is all that is needed. This is what most clocks AC powered use and it works well. In fact a dead clock might have most of the parts needed.
  • VaatiVaati Posts: 712
    edited 2009-05-14 01:27
    So... How would I count the cycles... ?

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • hover1hover1 Posts: 1,929
    edited 2009-05-14 01:36
    Vaati said...
    Ouch... Well, maybe I could write it so 30-day auctions can be entered only within 5 days of the end time.... But, that would be compensating user-friendliness for functionality... Tough choice...

    Also, I am terrible with three letter acronyms. What in the world does WWV stand for?

    Thanks.

    http://tf.nist.gov/stations/wwv.html

    ·
  • VaatiVaati Posts: 712
    edited 2009-05-14 01:42
    Thanks for the link. So, how would I get it to talk to the WWV time and compare? It sounds like it might be a sort of "master-slave" circuit...

    Thanks again.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • JonnyMacJonnyMac Posts: 9,195
    edited 2009-05-14 03:02
    If you decide to go the line frequency route I whipped up a little simulator object that will feed a pin what you'd see from an H11AA1 type circuit (I've used this in a couple dimmers). The nice thing about the simulator is that you can test code without having to connect any AC.

    Post Edited (JonnyMac) : 5/14/2009 3:17:28 AM GMT
  • kwinnkwinn Posts: 8,697
    edited 2009-05-14 03:09
    Try this circuit. You can add a bridge rectifier, capacitor, and regulator to power the prop as well.
  • VaatiVaati Posts: 712
    edited 2009-05-14 13:10
    @Kwinn
    So... Which circuit are you suggesting I try...?

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • kwinnkwinn Posts: 8,697
    edited 2009-05-14 13:21
    I would suggest you build a clock that runs off the power line. A 110V to 6V transformer, a diode and resistor to feed a 60HZ signal to a prop line, and a bridge rectifier/capacitor/regulator to power it from the transformer. Put in a battery backup for when the power goes out.
  • VaatiVaati Posts: 712
    edited 2009-05-14 19:02
    Whoah... Wait! I just realized that the Ebay auction page also showed the exact end time of the auction. Tha means that the prop could just take the start time (MM/DD/YY; HH/MM/SS A/PM) and subtract 1 second until it reaches the end time (MM/DD/YY; HH/MM/SS A/PM) so then it doesn't have to have a clock feature at all! Instead, all it does is subtract 1 sec until it reaches 1hr, 30 min, 10 min, 5 min, then end time.

    Would that work...?

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-14 21:52
    How do you know when 1 second goes by?
  • rokickirokicki Posts: 1,000
    edited 2009-05-14 22:08
    Well, we have text to speech now, right? Make the text to speech convert "one mississippi". That's gotta be pretty close.
  • VaatiVaati Posts: 712
    edited 2009-05-14 23:00
    @mike:
    Couldn't I use a tv-compatible timer such as the timer in the obex?· I modded it so it would work on the tv instead....


    @rokicki:
    Well, I did get that slight bit of humor there...· lol.gif·· But I can't get an EMIC shipped by tomorrow!· This project is for the Gadget Gangster Mother's Day contest...· The contest ends on the 17th, so I don't have a whole bunch of time...

    Please respond as soon as possible, because I really don't want to still be working on my project on sunday night....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • VaatiVaati Posts: 712
    edited 2009-05-15 02:13
    Okay, I have a wall adapter with an output of 6VAC @ 1100 mA... I also have a 2mm jack for it... Now, all I need is a schematic. Could you please post a little diagram of the wiring, kwinn?

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • kwinnkwinn Posts: 8,697
    edited 2009-05-15 03:31
    Sorry Vaati, I thought I posted it earlier. This is more of a block diagram than a schematic but it is a very simple circuit. Use the prop protoboard schematic for the power supply if this is not enough info.
  • VaatiVaati Posts: 712
    edited 2009-05-15 13:11
    kwinn,
    Hmm... Did you mean to post a schematic...? I don't see one.....

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • kwinnkwinn Posts: 8,697
    edited 2009-05-15 15:09
    OK, now I know something is wrong. I uploaded the diagram before I typed in the message last night. Any way here it is again ( I hope ).
  • VaatiVaati Posts: 712
    edited 2009-05-15 15:39
    Yes, that time, it did show up.· smile.gif· Well, I have a great countdown timer already!· It doesn't even use the AC Vpp idea!· But...· Theres a problem...· I modified the timer object in the obex and made it work on a tv.· If you have a prop and a tv, plug it in and run the attached program called timersomething.· It counts down, sure.· But, if you wait for the seconds to count to zero, it changes the minute, but it also changes the seconds to ASCII!· What have I done wrong?!?· confused.gif

    Please help...

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
  • kwinnkwinn Posts: 8,697
    edited 2009-05-15 17:34
    Are you sure Timer_something.spin is complete?
  • VaatiVaati Posts: 712
    edited 2009-05-15 18:44
    Okay, I got the countdown timer to work!!·· Now, all I need is info on how to connect a keyboard to the prop via ps/2, then my project is pretty much done!

    Never mind...· It turns out, the timer is still not working properly!!!· I attached·all of the files needed to run timer_something.
    Just so you know, the timer works fine until the minutes section goes to 00.· Then, things start going to the wrong place in the ASCII table....

    Let it run for about 10 or so minutes to see what the problem is.

    Thanks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!

    Post Edited (Vaati) : 5/15/2009 7:04:02 PM GMT
  • VaatiVaati Posts: 712
    edited 2009-05-15 22:44
    Can someone PLEASE try to see what is wrong with my code that I posted? I have no idea why it doesn't work...

    Help!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!
Sign In or Register to comment.