November 22, 2024, 10: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.


EZ-3

Started by cs1245, October 22, 2010, 11:43:30 PM

Previous topic - Next topic

cs1245

I have noticed a few times now when I go to turn on the MIB program on my Prop-1/EZ-3 that the LED lights for ON TIME and OFF TIME stay on when I move the toggle from position 0 to 1 and also from position 1 to 2 and dont turn off until I move the toggle back to position 0.  Normally these LED lights dont turn on unless I push the MAN TR button on the EZ3 or the PIR sensor is triggered.  To fix this I reload the MIB PBASIC program onto the Prop-1 and it works just fine.  Any ideas why this happens or how to prevent it?   

JonnyMac

I cant think of a reason why that would happen, unless there is a problem with your controller.
Jon McPhalen
EFX-TEK Hollywood Office

bsnut

I am going to agree with Jon, it could be the controller. What I suggest to is extend the PAUSE instruction before in entered the label Main this may or may not take care of the problem in the future. I have another way to do it, but I would need to look at the code. If you are using Jon's program template, I will show you my other way later on when I get to my laptop.
William Stefan
The Basic Stamp Nut

bsnut

Here is my easy way, if your program returns back to Main label.

Main:
  timer = 0                                     ' reset timer
  PINS = %00000000                    ' clear all outputs
  DIRS = %00111111                    ' make P0-P5 outputs


One good thing, by doing the above code it resets your program every time twice. What, I mean the label Reset does the same thing. Here a another way, if using PIR is this.

  PAUSE 60000                              ' PIR warm-up
Reset:
  timer = 0                                     ' reset timer
  PINS = %00000000                    ' clear all outputs
  DIRS = %00111111                    ' make P0-P5 outputs

William Stefan
The Basic Stamp Nut

cs1245

I will be using the PIR sensor.  Where will I need to cut and paste the code below into Jon's program he wrote for the MIB: 

  PAUSE 60000                              ' PIR warm-up
Reset:
  timer = 0                                     ' reset timer
  PINS = %00000000                    ' clear all outputs
  DIRS = %00111111                    ' make P0-P5 outputs[/color][/font]

bsnut

October 24, 2010, 07:34:06 AM #5 Last Edit: October 24, 2010, 07:42:52 AM by bsnut
You will place it under the Initialization section of the code. Like this

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

PAUSE 60000
Reset:
PINS = %00000000
DIRS = %00111111

This alouds the PIR to warm-up, but after 1 minute it will not be called again. Remember, I haven't seen the Jon's code that he wrote for you.

I have this question. Is the code that Jon wrote for you returning back to the Initialization section?
William Stefan
The Basic Stamp Nut

cs1245

Here is the code Jon wrote -

I cant tell for certain if it returns to the initialization, but from what I see it doesnt appear to return to the initialization section.

' -----[ Program Description ]---------------------------------------------
'
' MIB
'
' Trigger Delay... 0 TO 10 seconds
' On Time......... 0 TO 20 seconds
' Off Timer....... 0 TO 60 seconds
'
' For best accuracy of each stage you should run the POT Scaling program
' from the Run menu for each stage.  Set the scale value into the POT
' instruction for each stage.
'
' Trigger Delay... Pin 5
' On Time......... Pin 4
' Off Timer....... Pin 3
'
' Turn each pot fully clockwise and use the scale value provided.  The
' scale value will be around 100 but will vary from pot-to-pot based on
' minor component differences.


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


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

SYMBOL  Audio           = PIN7                  ' SETUP = DN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  AdjTrDelay      = 5                     ' on delay  (no ULN)
SYMBOL  AdjOnTime       = 4                     ' run time  (no ULN)
SYMBOL  AdjOffTime      = 3                     ' off delay (no ULN)
SYMBOL  Fogger          = PIN2                  ' fogger control relay
SYMBOL  Lights          = PIN1                  ' lights control relay
SYMBOL  Motor           = PIN0                  ' motor control relay


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  timer           = W0
SYMBOL   negFlag        =  BIT15


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

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

  GOTO Post_Delay                               ' let PIR warm-up


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

Main:
  timer = 0                                     ' reset timer

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


' Trigger delay is 0 to 10 seconds

Pre_Delay:
  POT AdjTrDelay, 100, timer                    ' raw input, 5 to 255
  timer = timer - 5                             ' correct low end offset
  IF negFlag = No THEN Run_Pre
    timer = 0                                   ' fix roll-under

Run_Pre:
  IF timer = 0 THEN MIB_Start                   ' skip if zero
  timer = timer * 40                            ' convert to 0 to 10s
  PAUSE timer


MIB_Start:
  Audio = IsOn                                  ' start audio
  PAUSE 1000
  Audio = IsOff
  Fogger = IsOn                                 ' pulse fogger 2s
  PAUSE 2000
  Fogger = IsOff


' On time is 1 to 20 seconds
' (minus 3 seconds for audio delay and fogger pulse)

Motor_Time:
  timer = 0
  POT AdjOnTime, 100, timer
  timer = timer - 5
  IF negFlag = No THEN Run_Motor
    timer = 0

Run_Motor:
  timer = timer * 80 - 3000                     ' adjust for audio + fogger
  Lights = IsOn
  Motor = IsOn
  PAUSE timer
  Motor = IsOff
  Lights = IsOff


' Off time is 1 to 60 seconds

Post_Delay:
  POT AdjOffTime, 100, timer                    ' raw input, 5 to 255
  timer = timer - 5                             ' correct low end offset
  IF negFlag = No THEN Run_Post
    timer = 0                                   ' fix roll-under

Run_Post:
  IF timer = 0 THEN Main                        ' skip if zero
  timer = timer * 240                           ' convert to 0 to 60s
  PAUSE timer

  GOTO Main


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


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



JonnyMac

At the bottom you'll see GOTO Main.  Everything should be off in the Post_Delay section so there is no need to jump back beyond Main.
Jon McPhalen
EFX-TEK Hollywood Office