November 24, 2024, 03:01:54 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.


Only triggers once

Started by skipmcnoob@yahoo.com, September 12, 2011, 04:57:58 PM

Previous topic - Next topic

skipmcnoob@yahoo.com

Hello All,
I have a code for a short show and there seems to be an error (made by myself) in the program somewhere, that I cant seem to find. If anyone has any suggestions of as to why this is not working it would be a BIG help ;D

' =========================================================================
'
'   File......
'   Purpose... Garner Holt Prod.
'   Author.... Chris Miller
'   E-mail.... skipmcnoob@yahoo.com
'   Created... 25 AUG 2011 - Generated by Vixen Prop-2 Sequencer Plug-in
'   Updated...
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


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


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

AudioStart      PIN     15                      ' SETUP = out
Trigger         PIN     14


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

T2400           CON     396
T9600           CON     84
T38K4           CON     6

Inverted        CON     $4000
Open            CON     $8000
Baud            CON     Open | T38K4            ' fast baud for accessories


IsActive        CON     1
IsNotActive     CON     0

IsOn            CON     1
IsOff           CON     0

EventDelay      CON     200


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

showBits        VAR     Word                    ' output + control bits
endOfShow       VAR     showBits.BIT15          ' 1 = stop when timer done

record          VAR     Word                    ' current sequence record
tix             VAR     Byte                    ' timing for record


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

Power_Up:
  PAUSE 2000                                    ' let everything start

Reset:
  OUTS = $0000                                  ' clear pins
  DIRS = $3FFF                                  ' P0..P13 are outputs

Audio_Reset:
  ' no audio device selected


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

Main:
  GOSUB Wait_For_Closed                         ' force door to be closed
  GOSUB Wait_For_Opened                         ' wait for door to open
  GOSUB WAIT_For_Closed                         ' and then close


Start_Audio:
  ' no audio device selected


Play_Show:
  READ (record * 3), Word showBits, tix         ' get outputs & timing
  OUTS = showBits & $3FFF                       ' update outputs

Timer:
  IF tix = 0 THEN Next_Step                     ' timer expired?
    PAUSE EventDelay                            '   no, time one "tic"
    tix = tix - 1                               '   decrement timer
    GOTO Timer                                  '   check again

Next_Step:
  INPUT AudioStart
  IF (endOfShow = IsOn) THEN Reset              ' done?
    record = record + 1                         '   no, point to next
    GOTO Play_Show                              '   and keep going


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

' Input pin (P14) is 1 when door is closed


Wait_For_Closed:
  tix = 0

WFC_Loop:
  PAUSE 5
  IF Trigger = IsNotActive THEN Wait_For_Closed
  tix = tix + 5
  IF tix < 100 THEN WFC_Loop

WFC_Exit:
  RETURN

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

' Input pin (P14) is 0 when door switch opened

Wait_For_Opened:
  tix = 0

WFO_Loop:
  PAUSE 5
  IF Trigger = IsActive THEN Wait_For_Opened
  tix = tix + 5
  IF tix < 100 THEN WFO_Loop

WFO_Exit:
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

Show_Data:
'
'
'
'             +-------------------- end of show Bit
'             |+------------------- trig
'             ||+------------------ Brightsign#1
'             |||+----------------- brightsign#2
'             ||||+---------------- overhead light
'             |||||+--------------- not active
'             ||||||+-------------- not active
'             |||||||+------------- not active
'             ||||||| +------------ LED 7
'             ||||||| |      +----- LED 0
'             ||||||| | 0-7  |
'             ||||||| |      |  +-- timing multiplier (1 to 255)
'             ||||||| |      |  |
  DATA  Word %0100000000000000, 1
  DATA  Word %0011000000000000, 1
  DATA  Word %0000000000000000, 34
  DATA  Word %0000000000000001, 1
  DATA  Word %0000000000000011, 1
  DATA  Word %0000000000000111, 1
  DATA  Word %0000000000001111, 1
  DATA  Word %0000100000011111, 1
  DATA  Word %0000100000111111, 1
  DATA  Word %0000100001111111, 3
  DATA  Word %0000100000000000, 36
  DATA  Word %0000000000000000, 119
  DATA  Word %1000000000000000, 1

JonnyMac

This is the second thread on the same project -- a violation of forum rules.  Please... I hate having to be the forums cop, don't make me.

Thread locked; resume this discussion in the original thread.
Jon McPhalen
EFX-TEK Hollywood Office