November 16, 2024, 03:55:55 AM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Bomb count down on prop-1

Started by gadget-evilusions, September 06, 2009, 12:55:47 AM

Previous topic - Next topic

gadget-evilusions

I would like to make a fake bomb prop with a count down timer. I was thinking of using this, https://www.parallax.com/Store/Accessories/Displays/tabid/159/CategoryID/34/List/0/Level/a/ProductID/52/Default.aspx?SortField=ProductName%2cProductName , as it seems like the most inexpensive display that would be capable of displaying 15:00, which I belive would be my starting time for my countdown.

What I would like to do is:

Power on, dispaly 15:00 (15 min, 00 seconds)
Normally open button on P6 is pressed, count down starts, counting down to 00:00
When count down is over, P0 (bomb) becomes high for 5 seconds
Display resets to 15:00 awaiting P6 again.

I don't really understand the programming of the display even after reading parallax's help documents and program examples.

Any help would be appreciated.

I am open to easier suggestions for display alternatives too.

Thank you
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

crpalmer

I can't help you with prop-1 code for the LCD, but I have one and it is very easy to use.  It has a serial interface and you send it ASCII characters to print or extra control characters to give it instructions.  For the timer, you'll want to send it $16 to disable the cursor and then send it $80 (or $85) before updating the time to jump to position 0 (or 5 for $85).  When you send the update, it will overwrite the display and does so in a very smooth fashion.

I have some prop-sx code that implements a count-down timer on the LCD if that's helpful to you I can post it.

JonnyMac

September 06, 2009, 05:30:27 AM #2 Last Edit: September 06, 2009, 05:37:27 AM by JonnyMac
Here's a program that will work with that display -- after seeing the program the docs might make more sense.  On the LCD SW1 is On and SW2 is OFF for 2400 baud.

' =========================================================================
'
'   File...... Countdown.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2009 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  TX              = 7                     ' SETUP = UP
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Flash           = PIN0


' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = T2400


' -----[ Variables ]-------------------------------------------------------

SYMBOL  timer           = B2
SYMBOL  mm10            = B3
SYMBOL  mm01            = B4
SYMBOL  ss10            = B5
SYMBOL  ss01            = B6
SYMBOL  temp            = B7

SYMBOL  secs            = W5


' -----[ Initialization ]--------------------------------------------------

Reset:
 PINS = %10000000                              ' preset pins
 DIRS = %10000001                              ' define outputs (1s)

 PAUSE 100                                     ' let LCD initialize

 secs = 15 * 60                                ' 15:00
 GOSUB Time_Display


' -----[ Program Code ]----------------------------------------------------

Main:
 timer = 0                                     ' reset timer

Check_Trigger:
 PAUSE 5                                       ' loop pad
 timer = timer + 5 * Trigger                   ' update timer
 IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

Countdown:
 PAUSE 950                                     ' tune for timing
 secs = secs - 1
 GOSUB Time_Display
 IF secs > 0 THEN Countdown

Kaboom:
 Flash = IsOn
 PAUSE 5000
 GOTO Reset


' -----[ Subroutines ]-----------------------------------------------------

Time_Display:
  temp = secs / 60
  mm10 = temp / 10
  mm01 = temp // 10
  temp = secs // 60
  ss10 = temp / 10
  ss01 = temp // 10

  SEROUT TX, Baud, ($16, $0C)                   ' no cursor, clear
  PAUSE 2
  SEROUT TX, Baud, ($85, #mm10, #mm01, ":", #ss10, #ss01)

 RETURN


' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

If you want to add a little more life to the display you could define an LED output called "Tick" and do this:

Countdown:
  Tick = IsOn
  PAUSE 500
  Tick = IsOff
  PAUSE 450                                     ' tune for timing
  secs = secs - 1
  GOSUB Time_Display
  IF secs > 0 THEN Countdown


This will toggle the Tick output every 0.5s while the display is counting down.
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

Your amazing as always. Thank you so much Jon.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

Reynold Electronics used to sell a 4-digit LED display called the SLED4 that would have worked and looked more like what you see in the movies, but they've "updated" it to serial and the lowest baud rate is 9600 (too fast for the Prop-1).

If this is a one-off prop you might snag one of the LED displays that my friend, Terry Hitt (the guy who wrote the SX/B compiler), has in his clearance store.  It's at the top of this page:

-- http://www.hittconsulting.com/miscforsale.html
-- http://www.hittconsulting.com/pdf/HC4LED_Datasheet.pdf

Jon McPhalen
EFX-TEK Hollywood Office