November 23, 2024, 02:01:41 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.


Mulitply Cylinders

Started by Halloween_SoCal, October 19, 2008, 08:55:12 AM

Previous topic - Next topic

Halloween_SoCal

I am running four air cylinders.  All will run off a 12V relay board.   So I plan to use OUTPUTS 1-4 to trigger the relay.
1/2 requires 2 cylinders, up and down.  Up for 2 seconds and then down for 2 seconds.
3 random for 3-8 seconds long, and then a delay of at least 20 seconds and no more than 40 seconds
4 random for 15 seconds long, and then a delay of at least 30 seconds and no more than 40 seconds

The whole program needs to run for about 4 minutes.

At present, I have them all working by single prop-1 controller boards for each of the cylinders. The exception is 1/2 are running within the program on the prop-1 controller (total of three controllers running the whole show).

Any help would greatly be appreciated.

I'm using the Prop-1 Controller.

So California Haunter

JonnyMac

Let me see if I understand:

A) Outputs 1 and 2 come on for two seconds, then go off for two seconds
B) Output 3 comes on for 3-8 seconds, then is off for 20-40 seconds
C) Output 4 comes on for 1-15 seconds, then is off 30-40 seconds

Is this show triggered externally?
Jon McPhalen
EFX-TEK Hollywood Office

Halloween_SoCal

1 will come on for two seconds.  Then 2 will come on for two seconds with 1 going off... basically two air cylinders are rocking a rocking chair back and fourth.
3 will come on for 3-8 seconds, then is off for about 20 to 40 seconds.
4 will come on for 5 (not 1 second) to 15 seconds and then is off 30-40 seconds.

A relay will trigger P-6 to activate.

SoCal_Haunter

JonnyMac

So, after #2 goes off then #3 runs -- #1/#2 just get the chair rocking, right?
Jon McPhalen
EFX-TEK Hollywood Office

Halloween_SoCal

I would like to run all three routines together.   1/2 and 3 and 4 together.  Also, its triggered by P-6.

Thanks
SoCa_Haunter

JonnyMac

I'm confused.... if they're all running at the same time, why use the trigger?  Can you explain in more detail how this is supposed to behave.  Sorry that I'm having a hard time understanding what you want from this prop.  Try to explain what one would see, rather than how you think the program will work.
Jon McPhalen
EFX-TEK Hollywood Office

Halloween_SoCal

Basically, I have a prop in a rocking chair, that is to go back and fourth (rocking).  He will be lifting a hatchet every now and then.  Behind him, I have a another prop where a crazy rat will jump out.

All are being driven by pneumatic cylinders.   It will be triggered remotely for its part of a bigger show.   


JonnyMac

So is it just sitting still when it's not triggered?  I'm still lost, sorry.  Or is the "trigger" input an enable signal that allow this prop to do it's thing while the signal is there?
Jon McPhalen
EFX-TEK Hollywood Office

Halloween_SoCal

I guess I am not sure what your asking?   We will use the P6 to activate the controller to run the program.  Basically, it will be "tripped or trigger" by a relay from another board as to start the program.

And please, I am in no rush for this.  I have the display already up and running by the means of three Prop-1 Controllers.   I wanted to see what it would like like by one Prop-1 controller and to learn from it.


JonnyMac

October 22, 2008, 11:18:46 AM #9 Last Edit: October 22, 2008, 11:25:03 AM by JonnyMac
Sorry, I've been a bit under the weather and my head in a fog -- I think I get it now.  This program runs four valves as you specify, after triggered, for four minutes (at this point everything resets).  This kind of coding can be a little tricky at first but once you get the hang of it you're able to do neat things.

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


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Cylinder4       = PIN3
SYMBOL  Cylinder3       = PIN2
SYMBOL  Cylinder2       = PIN1
SYMBOL  Cylinder1       = PIN0


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  master          = W1                    ' master show timer
SYMBOL  timer12         = W2                    ' for cylinders 1/2
SYMBOL  timer3          = W3                    ' for cylinder  3
SYMBOL  timer4          = W4                    ' for cylinder  4
SYMBOL  lottery         = W5


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

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00001111                              ' set outputs


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

Main:
  master = 0                                    ' reset timer

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

  ' timing below this point is in 100ms units

Set_Show:
  master = 2400                                 ' set show to 4 mins
  Cylinder1 = IsOn
  timer12 = 20                                  ' set for 2 secs
  Cylinder3 = IsOff
  timer3 = 0                                    ' trigger new cycle
  Cylinder4 = IsOff
  timer4 = lottery // 101 + 400                 ' randomize, 30 to 40



Check_Cyl12:
  IF timer12 = 0 THEN Toggle_12                 ' timer expired?
    timer12 = timer12 - 1                       ' no, update
    GOTO Check_Cyl3                             '  and move on

Toggle_12:
  Cylinder1 = 1 - Cylinder1                     ' flip state
  Cylinder2 = 1 - Cylinder1                     ' make opposite of #1
  timer12 = 20                                  ' reset timer



Check_Cyl3:
  IF timer3 = 0 THEN Check_3On                  ' timer expired?
    timer3 = timer3 - 1                         ' no, update
    GOTO Check_Cyl4

Check_3On:
  IF Cylinder3 = IsOn THEN Cyl3_Off             ' on now?
    Cylinder3 = IsOn                            ' no, turn it on
    RANDOM lottery                              ' re-stir random #
    timer3 = lottery // 51 + 30                 ' random, 3 to 8 secs
    GOTO Check_Cyl4

Cyl3_Off:
  Cylinder3 = IsOff
  RANDOM lottery
  timer3 = lottery // 201 + 200                 ' randomize, 20 to 40 secs



Check_Cyl4:
  IF timer4 = 0 THEN Check_4On                  ' timer expired?
    timer4 = timer4 - 1                         ' no, update
    GOTO Update_Show

Check_4On:
  IF Cylinder4 = IsOn THEN Cyl4_Off             ' on now?
    Cylinder4 = IsOn                            ' no, turn it on
    RANDOM lottery                              ' re-stir random #
    timer4 = lottery // 141 + 10                ' random, 1 to 15 secs
    GOTO Update_Show

Cyl4_Off:
  Cylinder4 = IsOff
  RANDOM lottery
  timer4 = lottery // 101 + 300                 ' randomize, 30 to 40 secs



Update_Show:
  PAUSE 95                                      ' pad for 100ms loop
  IF master = 0 THEN Reset                      ' done?
    master = master - 1                         ' no, update master timer
    GOTO Check_Cyl12                            ' back to top of show


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


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


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

Halloween_SoCal

WOW.  I will try it out tonight and see how it goes.   I will keep you posted!

Thanks a much!!!