November 23, 2024, 04:22:51 AM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Question about moving from a PROP1 to a PROP2 controller

Started by ChrisV2, September 22, 2012, 05:55:08 PM

Previous topic - Next topic

ChrisV2

Hey Jon,

As requested, I'm moving this line of question/answer to the correct forum thread.

Because we haven't used a PROP2 controller before, we were hesitant to start that learning curve. But... if it's as easy as porting our code over to it with a few minor changes and it'll work as we'd hoped, then we're game!!

As a side note on the actual PROP2 controller, we took your class a few years ago at the Dallas haunt convention and made some notes that we were supposed to modify the PROP1 board before using it. Moving jumper connectors and breaking off a pin from the chip on the PROP1 board. Is that something that needs to be done on the PROP2 Controller?

--

Below is our PROP1 code. Right now we're simulating a switch by shorting the Red/White wires from P6 on the PROP1 controller.

Through testing today, I found out the hard way what you shared earlier, is that I can not use all outputs if I'm using a switch. I can get our code to work just fine using only 6 of the outputs.

I "briefly" looked into moving all this to a PROP2 controller, but quickly realized I was going to have to rewrite this program with different syntax. It was giving me a lot of errors when I tried to save the program (previously saved as a BS2 program) to the PROP2 controller...

So we're stuck... please help?


====================


Specifics...

Q: How many outputs are on at the same time?
A: No more than one at a time but we would like to use all 8 outputs.
    The good news is that they don't want it to be random now, but a static sequence of output 0,7,3,2,5,4,6,1

Q: How long is the output supposed to be on?
     -- or does it go off if randomly selected to go off (in case of multiple outputs)
A: They would like the output to be "on" as long as the switch is closed. Obviously it would have to complete the current cycle before checking the switch status again.

Q: If it's just one at a time ("one-shotting") how long is the output on?
A: We're thinking that the flame should be on for 0175 ms.

Q: Is there any delay between outputs being activated?
A: A pause of 0175 ms between each of the 8 firing.

====================


' =========================================================================
'
'   File...... Flamer.BS1
'   Purpose...
'   Author....
'   E-mail....
'   Started... 2012-09-22
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


' -----[ I/O Definitions ]-------------------------------------------------
SYMBOL  Flame jet1     = 0                     ' Flame jet1 on OUT0
SYMBOL  Flame jet2     = 1                     ' Flame jet2 on OUT1
SYMBOL  Flame jet3     = 2                     ' Flame jet3 on OUT2
SYMBOL  Flame jet4     = 3                     ' Flame jet4 on OUT3
SYMBOL  Flame jet5     = 4                     ' Flame jet5 on OUT4
SYMBOL  Flame jet6     = 5                     ' Flame jet6 on OUT5
SYMBOL  Flame jet7     = 6                     ' Flame jet7 on OUT6
SYMBOL  Flame jet8     = 7                     ' Flame jet8 on OUT7

SYMBOL  Trigger              = PIN6                  ' Setup = DN

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  TrOn            = 1                     ' Active-High I/O
SYMBOL  TrOff           = 0                     '

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


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

SYMBOL  timer           = B2                    ' For Debounce Loop
SYMBOL  thePin          = B3                    ' Current Output Pin
SYMBOL  lastPin         = B4                    ' Last Output Activated

SYMBOL  lottery         = W5                    ' random value

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

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %11111111                              ' Make all outputs active


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

Main:
  timer = 0                                     ' Reset Timer

Check_Trigger:
'  PAUSE 5                                       ' Scan Delay
  DEBUG "Checking trigger "
  IF Trigger = TrOff THEN Main                  ' Check Trigger Input
    DEBUG "Trigger tripped "
    timer = timer + 5                           ' Update Timer
  IF timer < 5 THEN Check_Trigger             ' Check timer

Activate_Flame:

  HIGH Flame jet1                         ' Start air Flame jet1
  DEBUG "Flame Burst  1 - "
  PAUSE 0175                                    ' Hold for .5 seconds
  LOW Flame jet1                          ' Stop Flame jet1
  DEBUG "Pausing..."
  PAUSE 0175                                    ' Hold for .5 seconds

  HIGH Flame jet8                         ' Start air Flame jet1
  DEBUG "Flame Burst  8 - "
  PAUSE 0175                                    ' Hold for .5 seconds
  LOW Flame jet8                          ' Stop Flame jet1
  DEBUG "Pausing..."
  PAUSE 0175                                    ' Hold for .5 seconds

  HIGH Flame jet4                         ' Start air Flame jet1
  DEBUG "Flame Burst  4 - "
  PAUSE 0175                                    ' Hold for .5 seconds
  LOW Flame jet4                          ' Stop Flame jet1
  DEBUG "Pausing..."
  PAUSE 0175                                    ' Hold for .5 seconds

  HIGH Flame jet3                         ' Start air Flame jet1
  DEBUG "Flame Burst  3 - "
  PAUSE 0275                                    ' Hold for .5 seconds
  LOW Flame jet3                          ' Stop Flame jet1
  DEBUG "Pausing..."
  PAUSE 0175                                    ' Hold for .5 seconds

  HIGH Flame jet6                         ' Start air Flame jet1
  DEBUG "Flame Burst  6 - "
  PAUSE 0275                                    ' Hold for .5 seconds
  LOW Flame jet6                          ' Stop Flame jet1
  DEBUG "Pausing..."
  PAUSE 0175                                    ' Hold for .5 seconds

  HIGH Flame jet5                         ' Start air Flame jet1
  DEBUG "Flame Burst  5 - "
  PAUSE 0275                                    ' Hold for .5 seconds
  LOW Flame jet5                          ' Stop Flame jet1
  DEBUG "Pausing..."
  PAUSE 0175                                    ' Hold for .5 seconds

  HIGH Flame jet7                         ' Start air Flame jet1
  DEBUG "Flame Burst  7 - "
  PAUSE 0175                                    ' Hold for .5 seconds
  LOW Flame jet7                          ' Stop Flame jet1
  DEBUG "Pausing..."
  PAUSE 0175                                    ' Hold for .5 seconds

  HIGH Flame jet2                         ' Start air Flame jet1
  DEBUG "Flame Burst  2 || "
  PAUSE 0175                                    ' Hold for .5 seconds
  LOW Flame jet2                          ' Stop Flame jet1
  DEBUG "Pausing..."
  PAUSE 0175                                    ' Hold for .5 seconds

  GOTO Main                                     ' start over


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


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


' -----[ User Data ]-------------------------------------------------------

JonnyMac

September 22, 2012, 07:34:23 PM #1 Last Edit: September 22, 2012, 07:36:33 PM by JonnyMac
Here's the way I would do it on the Prop-2.  Note that I think you're going to have to change the timing because you Prop-1 program has DEBUG statements inserted between HIGH and PAUSE, and these take a little time. This version uses P14 on the Prop-2 as the trigger and the outputs are OUT0 through OUT7 in the order you desire (see table at end).

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


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


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

Sio             PIN     15                      ' no ULN, SETUP = UP
Trigger         PIN     14                      ' SETUP = DN


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

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

TrOn            CON     1
TrOff           CON     0

Yes             CON     1
No              CON     0

ON_TIME         CON     175
OFF_DELAY       CON     175


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

idx             VAR     Byte                    ' sequence index
activePin       VAR     Byte

timer           VAR     Word


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

Reset:
  OUTH = %00000000 : OUTL = %00000000           ' clear all
  DIRH = %00000000 : DIRL = %11111111           ' set outputs

  timer = 0                                     ' reset for new cycle


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

Main:
  DO WHILE (timer < 100)                        ' debounce = 100ms
    PAUSE 5
    IF (Trigger = TrOn) THEN
      timer = timer + 5
    ELSE
      timer = 0
    ENDIF
  LOOP

Fire_Cycle:
  FOR idx = 0 TO 7                              ' loop through all
    READ Sequence+idx, activePin                ' get pin
    HIGH activePin                              ' activate
    PAUSE ON_TIME                               ' hold on
    LOW activePin                               ' de-activate
    PAUSE OFF_DELAY                             ' off delay
  NEXT

  IF (Trigger = TrOn) THEN                      ' trigger still active?
    GOTO Fire_Cycle                             ' run again
  ELSE
    GOTO Reset                                  ' wait for next trigger
  ENDIF


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


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


' -----[ User Data ]-------------------------------------------------------

Sequence        DATA    0, 7, 3, 2, 5, 4, 6, 1
Jon McPhalen
EFX-TEK Hollywood Office

ChrisV2

Hey Jon,

Yeah... I tend to over do the DEBUG statements while the code is in development, especially when we're having problems.

I didn't realize that it would slow the code down, but in retrospect it makes a lot of sense. After growing the program, I did have to take out quite a few of them though since I filled up the programming memory!!

I really like the use of that User Data. I'm going to have to start doing that.

Also, I'm trying to talk the haunt owner into buying some potentiometer so I can hopefully take out the static delays and make the timing/delays variable based on a foot pedal or a gear shift setting.

If we did that... how might we be able to fit that into your most excellent code?

Thanks again!!