November 21, 2024, 04:38:10 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Hell-O-Vator Network of Prop-1, HC-8 (2) , AP16 Large Prop setup and Coding

Started by michilson, August 28, 2014, 03:17:40 PM

Previous topic - Next topic

michilson

Okay guys heres the Program file for this hopefully I have it close. Please let me know what you thing or if there are any errors.

Thanks

michilson

' =========================================================================
'
'   File......
'   Purpose...
'   Author.... Michael Chilson
'   E-mail.... m_chilson@hotmail.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Elevator program for Hell-O-Vator prop ride. Using HC-8 & Prop 1 & AC-16+
'
'
' -----[ Program Doc HC8 ]-------------------------------------------
'
' Demonstration program for the HC-8+ IO Control Board.  All commands are
' sent to the HC-8+ through a serial link at 2400 baud (OT2400 baudmode).
' The use of the open baudmode allows boards to be daisy-chained for up to
' 32 fader outputs from one I/O pin.
'
' Configuration swtich settings
'  -- BR = off (2400 baud for Prop-1)
'  -- A1 = high bit of address
'  -- A0 = low bit of address
'  -- SM = off (for EFX-TEK serial mode)
'
' Command syntax: "!HC8", address, cmd {, data ... }
' -- where "address" is %00 (0) to %11 (3), or $FF (255) for all
' -- "cmd" is a single character
' -- optional "data" is one or more bytes
'
' Valid commands:
'
'   "!HC8", address, "X"
'     -- sets all channels to 0% (off)
'     -- rescans DMX.A8 switch for PWM mode (off = linear, on = log)
'
'   "!HC8", address, "V"
'     -- requests version string from HC-8+
'     -- should be followed by SERIN to receive three-byte string
'     -- does not work with global address
'
'   "!HC8", address, "L", channel, level
'     -- sets "channel" (0..7) to "level" (0 to 255)
'        * channel is 0 to 7 (one) or "A" (all channels)
'
'   "!HC8", address, "L", "I", level0, level1, level2, ... level7
'     -- sets all channels individually
'     -- transmit up to eight levels
'        * if less than 8 last byte must be followed by 50ms PAUSE
'
'   "!HC8", address, "L", "R", mask
'     -- randomize (0% to 100%) channel levels
'     -- only channels with "1" in "mask" bit are modified
'        * e.g., mask = %00001111 (only OUT0 -> OUT3 updated)
'
'   "!HC8", address, "D", channel, state
'     -- sets output (in "channel") to state.bit0
'        * channel is 0 to 7 (one) or "A" (all channels)
'
'   "!HC8", address, "D", "S", states, mask
'     -- sets select outputs(in "mask") digitially (off or on) to "states"
'     -- only channels with "1" in "mask" bit are modified
'
'   "!HC8", address, "D", "R", mask
'     -- digitally randomizes outputs (on or off)
'     -- only channels with "1" in "mask" bit are modified
'
'   "!HC8", address, "F", "L", channel, start, stop, seconds
'     -- fade channel from start to stop
'        * channel is 0 to 7 (one) or "A" (all channels)
'     -- duration of fade is seconds
'
'   "!HC8", address, "F", "M", channel, start, stop, tenths
'     -- fade channel from start to stop
'        * channel is 0 to 7 (one) or "A" (all channels)
'     -- duration of fade is tenths x 100ms
'
'   "!HC8", address, "F", "H", channel, start, stop, msLow, msHigh
'     -- fade channel from start to stop
'        * channel is 0 to 7 (one) or "A" (all channels)
'     -- duration of fade is milliseconds
'
'   "!HC8", address, "F", "X", chA, chB, tenths
'     -- cross fades from "chA" and "chB"
'     -- "chA" starts at 100%
'     -- "chB" starts at 0%
'     -- duration of fade is tenths x 100ms
'
'   "!HC8", address, "G", channel
'     -- retrieves present dimmer level of single channel (0 to 7)
'     -- should be followed by SERIN to receive level
'     -- does not work with global address
'
'   "!HC8", address, "I"
'     -- retrieves TTL inputs
'     -- should be followed by SERIN to receive inputs byte
'     -- does not work with global address
'
'
' Note: The ULN2803A interferes with serial transmission to HC-8+; remove
'       and replace with ULN2003A (7 channels), leaving P7 contacts open.

' -----[ Program Description For Ap16 ]---------------------------------------------

' Demonstration program for the AP-16+ Audio Player Board.  All commands are
' sent to the AP-16+ through a serial link at 38.4K baud (open baudmode).
'
' Command syntax: "!AP16", address, cmd {, sub-cmd} {, data}
' -- where 'address' is %00 to %11
' -- 'cmd' and 'sub-cmd' is a single character
' -- optional 'data' is one or or bytes
'
' Valid commands:
'
'   "!AP16", address, "V"
'     -- requests version string from AP-16+
'     -- should be followed by SERIN to receive three-byte string
'
'   "!AP16", address, "G"
'     -- retrieves current AP-16+ status
'     -- should be followed by SERIN to receive one-byte status
'     -- status byte is bit-mapped:
'        * BIT7 : 0 = idle, 1 = playing
'        * BIT6 : 0 = single play, 1 = looping
'        * BIT5 : 0 = SFX or AUX, 1 = named WAV (PW command)
'        * BIT4 : 0 = SFX file, 1 = AUX file
'        * BIT3 : file #, bit3
'        * BIT2 : file #, bit2
'        * BIT1 : file #, bit1
'        * BIT0 : file #, bit0
'
' * "!AP16", address, "PS", file#, loops
'     -- plays selected sfx (0 - 15) file
'     -- loops is number of times to play (0 = loop forever)
'
' * "!AP16", address, "P?", file#, loops
'     -- plays random sfx (0 - file#) file
'     -- loops is number of times to play (0 = loop forever)
'
' * "!AP16", address, "PA", file#, loops
'     -- plays selected aux (1 - 8) file
'     -- loops is number of times to play (0 = loop forever)
'
' * "!AP16", address, "PW", "filename", CR, loops
'     -- plays named WAV file
'        > name must be 8 or fewer chracters
'        > ".wav" extension is optional (added by player if not present)
'        > file name must be terminated with CR (13)
'     -- loops is number of times to play (0 = loop forever)
'
' * "!AP16", address, "L", left, right
'     -- sets channel volume levels (0 to 100)
'
' * "!AP16", Address, "R", status
'     -- sets relay to status (1 = on, 0 = off)
'     -- requires version 1.7 update
'
' * "!AP16", address, "X"
'     -- stops AP-16+ (if playing)
'
' Note: Commands marked with * will respond to global address (255)
'
' Note: ULN2803 interferes with serial transmission to AP-16+; remove and
'       replace with ULN2003 (7 channels), leaving P7 contacts open.




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

SYMBOL  TRIGGER1        = PIN0                                                ' PIR Motion Sensor (For Exit Door Close)
SYMBOL  TRIGGER2        = PIN1                                                ' Call Button
SYMBOL  TRIGGER3        = PIN2                                                ' Floor 13 Button

SYMBOL  D1              = PIN3                                                ' Entry Door Control
SYMBOL  D2              = PIN4                                                ' Exit Door Control
SYMBOL  M1              = PIN5                                                ' Fast Movement Up / Down
SYMBOL  M2              = PIN6                                                ' Slow Movement Up / Down
SYMBOL  SIO             = PIN7                                                ' TTL COM PORT

' -----[ I/O Definitions HC-8 #1 ]----------------------------------------------------

'Channel 1 Call Button Light
'Channel 2 Floor 13 BUTTON Light
'Channel 3 Floor Basement BUTTON Light
'Channel 4 Floor 1 BUTTON Light
'Channel 5 Floor 2 BUTTON Light
'Channel 6 Floor 3 BUTTON Light
'Channel 7 Floor 4 BUTTON Light


' -----[ I/O Definitions HC-8 #2 ]----------------------------------------------------

'Channel 1 Floor 5 BUTTON Light
'Channel 2 Floor 6 BUTTON Light
'Channel 3 Floor 7 BUTTON Light
'Channel 4 Floor 8 BUTTON Light
'Channel 5 Floor 9 BUTTON Light
'Channel 6 Floor 10 BUTTON Light
'Channel 7 Floor 11 BUTTON Light
'Channel 8 Floor 12 BUTTON Light

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

'SEROUT Sio, Baud, ("!AP16", %01, "PS", 1, 0)      '%01 = Address  "PS" = PLAY , TRACK 1 (Elevator Music) , LOOP Once
'SEROUT Sio, Baud, ("!AP16", %01, "PS", 2, 0)      '%01 = Address  "PS" = PLAY , TRACK 2 (Skreaching Breaks w/ Cable Snap), LOOP Once
'SEROUT Sio, Baud, ("!AP16", %01, "PS", 3, 0)      '%01 = Address  "PS" = PLAY , TRACK 3 (Metal Crashing), LOOP Once
'SEROUT Sio, Baud, ("!AP16", %01, "PS", 4, 0)      '%01 = Address  "PS" = PLAY , TRACK 4 (Screams / Demon Voices), LOOP Once
'SEROUT Sio, Baud, ("!AP16", %01, "PS", 5, 0)      '%01 = Address  "PS" = PLAY , TRACK 5 (Elevator Ding)
'SEROUT Sio, Baud, ("!AP16", %01, "PS", 6, 0)      '%01 = Address  "PS" = PLAY , TRACK 6 (Going Down)
'SEROUT Sio, Baud, ("!AP16", %01, "X")             ' Reset Audio Player

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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  CHON            = 100
SYMBOL  CHOFF           = 0

SYMBOL  Baud            = OT2400

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

SYMBOL  timer           = B2
SYMBOL  timer1          = B3

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

Power_Up:
  ' put code here that only happens at power-up/hard reset

Reset:
  PINS = %00000000                              ' all off
  DIRS = %00111111                              ' P5..P0 are outputs


michilson

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

Main:
  timer = 0                                     ' reset timer
  timer1 = 0                                    ' reset timer1
  Index = 0                                     ' Reset Door Index

Check_Trigger2:
  PAUSE 5                                       ' loop pad
  timer1 = timer1 + 5 * Trigger2                   ' update timer1
  IF timer1 < 100 THEN Check_Trigger2


IF TRIGGER2 = ISON THEN SEROUT Sio, Baud, ("!HC8", %01, "D", 1, 1)                  ' Channel 1 Call BUTTON Light ON
    PAUSE 50

PAUSE 10000                                                                         ' 10 Sec Pause

SEROUT Sio, Baud, ("!AP16", %01, "PS", 5, 0)                                        ' Elevator Door Ding

PAUSE 2000                                                                          ' 2 Sec Pause

SEROUT Sio, Baud, ("!HC8", %01, "D", 1, 0)                                          ' Channel 1 Call BUTTON Light OFF

D1 = IsOn                                                                           ' Elevator Door Open
SEROUT Sio, Baud, ("!AP16", %01, "PS", 1, 0)                                        ' Elevator Elevator Music
SEROUT Sio, Baud, ("!HC8", %01, "D", 4, 1)                                          ' 1st Floor Light On

IF Trigger3 = ISOn THEN SEROUT Sio, Baud, ("!HC8", %01, "D", 3, 1)                  'Channel 2 Floor 13 BUTTON Light On

PAUSE 2000                                                                          ' 2 Sec Pause

D1 = IsOff                                                                          ' Entry Door Close
PAUSE 5000
SEROUT Sio, Baud, ("!HC8", %01, "D", 4, 0)                                          ' 1st Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
M1 = IsOn                                                                           ' Fast Movement On
M2 = IsOn                                                                           ' Slow Movement On
PAUSE 500                                                                           ' .5 Sec Pause
M1 = IsOFF                                                                          ' Fast Movement OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 5, 1)                                          ' 2nd Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 5, 0)                                          ' 2nd Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 6, 1)                                          ' 3rd Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 6, 0)                                          ' 3rd Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 8, 1)                                          ' 4th Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 8, 0)                                          ' 4th Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 1, 1)                                          ' 5th Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 1, 0)                                          ' 5th Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 2, 1)                                          ' 6th Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 2, 0)                                          ' 6th Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 3, 1)                                          ' 7th Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 3, 0)                                          ' 7th Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 4, 1)                                          ' 8th Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 4, 0)                                          ' 8th Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 5, 1)                                          ' 9th Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 5, 0)                                          ' 9th Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 6, 1)                                          ' 10th Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 6, 0)                                          ' 10th Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 7, 1)                                          ' 11th Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 7, 0)                                          ' 11th Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 8, 1)                                          ' 12th Floor Light ON
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 8, 0)                                          ' 12th Floor Light OFF
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, Baud, ("!AP16", %01, "PS", 5, 0)                                        ' Elevator Door Ding
PAUSE 1000                                                                          ' 1 Sec Pause

M1 = ISOn                                                                           ' Fast Movement On
SEROUT Sio, Baud, ("!AP16", %01, "PS", 6, 0)                                        ' %01 = Address  "PS" = PLAY , TRACK 6 (Going Down)
SEROUT Sio, Baud, ("!AP16", %01, "PS", 2, 0)                                        ' %01 = Address  "PS" = PLAY , TRACK 2 (Skreaching Breaks w/ Cable Snap), no LOOP

M2 = IsOff                                                                          ' Slow Movement Up Off
PAUSE 500                                                                           ' .5 Sec Pause
M1 = IsOff                                                                          ' Fast movement is Off
SEROUT Sio, Baud, ("!HC8", %10, "D", 8, 1)                                          ' 12th Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 8, 0)                                          ' 12th Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 7, 1)                                          ' 11th Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 7, 0)                                          ' 11th Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause

M2 = IsOn                                                                           ' Slow Movement Up ON

SEROUT Sio, Baud, ("!HC8", %10, "D", 6, 1)                                          ' 10th Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 6, 0)                                          ' 10th Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 5, 1)                                          ' 9th Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 5, 0)                                          ' 9th Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 4, 1)                                          ' 8th Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 4, 0)                                          ' 8th Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 3, 1)                                          ' 7th Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 3, 0)                                          ' 7th Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 2, 1)                                          ' 6th Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 2, 0)                                          ' 6th Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 1, 1)                                          ' 5th Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %10, "D", 1, 0)                                          ' 5th Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause

M2 = IsOff                                                                          ' Slow Movement Up OFF

SEROUT Sio, Baud, ("!HC8", %01, "D", 8, 1)                                          ' 4th Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 8, 0)                                          ' 4th Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 6, 1)                                          ' 3rd Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 6, 0)                                          ' 3rd Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 5, 1)                                          ' 2nd Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 5, 0)                                          ' 2nd Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 5, 1)                                          ' 2nd Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 5, 0)                                          ' 2nd Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 4, 1)                                          ' 1st Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 4, 0)                                          ' 1st Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 3, 1)                                          ' Basement Floor Light ON
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!HC8", %01, "D", 3, 0)                                          ' Basement Floor Light OFF
PAUSE 250                                                                           ' .25 Sec Pause
SEROUT Sio, Baud, ("!AP16", %01, "PS", 3, 0)                                        ' (Metal Crashing), no LOOP
SEROUT Sio, Baud, ("!AP16", %01, "PS", 4, 0)                                        ' (Screams / Demon Voices), No LOOP

PAUSE 5000                                                                          ' 5 Sec Pause
D2 = Ison                                                                           ' Exit Door Open

Check_Trigger:
  PAUSE 5                                                                           ' loop pad
  timer = timer + 5 * Trigger                                                       ' update timer1
  IF timer < 100 THEN Check_Trigger                                                 ' Check to make sure everyone out

PAUSE 5000

D2 = IsOff                                                                          ' Exit Door Closes

SEROUT Sio, Baud, ("!AP16", %01, "X")                                               ' Reset Audio Player
PAUSE 1000                                                                          ' 1 Sec Pause
SEROUT Sio, OT2400, ("!HC8", %01, "X")                                              ' Reset HC #1
SEROUT Sio, OT2400, ("!HC8", %10, "X")                                              ' Reset HC #2


GOTO Reset

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


JonnyMac

For programs that are more than 20 or 30 lines, please also attach them as a download.

Also, if you want to embed your listing, PLEASE select all the code and set the Font Face to Courier -- this will make the code much easier to read. I also set the color to blue.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Quote...or if there are any errors.

There are many syntax errors and even after those are corrected, you run out of EEPROM space about half way through the listing. You would have seen this had you at least attempted to compile the code. Please, I beg you, do that small step before posting.

As I tend to repeat every year, it is best to develop programs in small, discrete steps. You don't help yourself by writing a giant program and never testing it along the way.

And, again, why would you use a Prop-1 as the brain of your project when you have an HC-8+ that is infinitely more powerful? Honestly, I'm confused...

Sorry to continue to be redundant, but you should post the INTENT of your program (in English) before requesting code help. It's not always easy to deduce the purpose of a program from a sparse listing.

I'm going to see if I can use some tricks to reduce the code space used -- and I will still suggest that you use the HC-8+ as the master.

I've attached a version with the syntax errors fixed, but as you can see, it is not even close to fitting into the Prop-1.

Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

SEROUT uses a lot of program space, so you want to minimize the number of times you use it to help keep your program small. And by thinking about your outputs

If I was doing this I would put floors 1-8 on and HC-8+ at address %00, and floors 9-13 on outputs 0-4 on the second HC-8+ at address %01. By organizing this way, we can create small code blocks to do a lot of work.

Remember that channel #s on the HC-8+ are 0-7.

' Set floor indicator light
' -- floor # is 1 to 13
' -- state is 0 (off) or 1 (on)

Set_Floor:
  addr = %00                                   ' assume floors 1-8
  IF floor < 9 THEN SF_Now                     ' if yes, do it now
    addr = %01                                 ' adjust address
    floor = floor - 8                          ' adjust floor #

SF_Now:
  floor = floor - 1                            ' adjust for HC-8+
  SEROUT Sio, Baud, ("!HC8", addr, "D", floor, state)
  RETURN

Jon McPhalen
EFX-TEK Hollywood Office

michilson

Jon, I did start running check just jumped the gun a little uploading it a little to early! As for the text change no problem I'll make that note for future uploads. I've never writen a program this big so I'm not 100 percent on what all I needed to make this work. And your right I should have included a little more detail about the overall goal. So here goes:

Inputs:

Call button outside
13th floor button
Pir to hold exit doors open

6 audio tracks needed cued at:

Door open
Each floor when reached
(2) at 13th floor
(2) at basement level

Motion platform / doors
(2) valves entry / exit
(2) valves fast and slow motion

Lights:
Call button
(14) one per floor

Program concept:
Press call button starts sequence
Door sound
Doors open
Stay open till
13th floor is pressed and call button is released

Floor lights increase as floor ding go off also raising motion platform

Once reach 13th floor (2) audio tracks play
The motion floor drops and the floor lights tumble down to basement

(2) two more audio tracks play

Doors open and when pir goes inactive the doors close and program resets

I hope this helps to clarify what the concept of this is! I was going to ask about the EEPROM error and what that ment! Hopefully we can cut this down some!

JonnyMac

Okay, here's the deal: I have 20 years experience with the BASIC Stamp 1 controller (brain of the Prop-1) and I know every trick in the book -- because I wrote the book! :)

Your program will not fit. Period. I came much closer than you (see attached), but despite two hours of bending and twisting code every way I could think of, it just will not fit.

Please, I beg you, put the Prop-1 to use elsewhere and use three HC-8+s for your Hell-o-vater. Anything that is enclosed and simulates motion needs to be handled carefully. With three HC-8+s we can do all kinds of things, including adding a provision for an emergency stop.

BTW... if I'm understanding your code, you seem to be under the impression that the AP-16+ can play two files at the same time. It can't.
Jon McPhalen
EFX-TEK Hollywood Office

michilson

Thanks jon. i wasn't set on using the Prop-1 just from the documents i was looking at my understanding was it was needed for the brian to control the HC-8. So if I can run this with 3 of them all the better however can you give I am assuming they are connected via the serial connection?

I would have to look at the code again but I dont think I am trying to play two files at once it should be play one then when that finishes play the next.

Now the next question then is each HC-8 has a portion of the overall code correct? then your bouncing between them for the sequence to run in order?

Thanks again

JonnyMac

With three HC-8+s, you will use one as the master, two as slaves. The slave devices do not have to be reporgrammed; they can be controlled from the master HC-8+ serial port with the AP-16+.

The advantage is speed (the Propeller is 1000x+ faster than the BS1), programming space, and multiple cores. We can even implement an emergecy stop into the routine.

QuoteI would have to look at the code again but I dont think I am trying to play two files at once it should be play one then when that finishes play the next.

You're doing this:

  SEROUT Sio, Baud, ("!AP16", %01, "PS", 6, 0)
  SEROUT Sio, Baud, ("!AP16", %01, "PS", 2, 0)


In this case, you would only hear a blip out of the first file. As soon as you send the second command, that file starts playing. What you need to do is poll the AP-16+ for its status to check if the first file is finished. We may add a queuing feature to a future generation AP-16+, but at the moment a Play command is immediate.

Please start a new thread in the "Hacking the HC-8+" forum and I will post a code template for you there. The template will let you control the AP-16+ and remote IOs on the slave HC-8s.

Do you have a Prop-Plug? You'll need one for reprogramming the master HC-8+.
Jon McPhalen
EFX-TEK Hollywood Office