November 21, 2024, 10:15:37 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.


New aproach

Started by aquawilly54, September 06, 2018, 07:20:13 PM

Previous topic - Next topic

aquawilly54

September 06, 2018, 07:20:13 PM Last Edit: September 06, 2018, 09:34:58 PM by aquawilly54
Ok, let's forget the relay.  Instead, what I need help with is using Pin 7 as an output for a device using a serial connector.  I've been looking all night, and I don't see any uses of P7 other than for RC boards, AP's or used as in input.  I did find out after reading the P7 pitfalls again and again is that the pins 0 thru 5 seem to be constantly powered, so I obviously can't program those either at this point.  I just need to know the proper coding for using P7 as a serial connected output - not for sound or RC boards. 

This is another attempt at the programming.  I really am trying.  On a good note; last year I only needed help once.  :)


I also don't know why I can't attach the program.  The browser can only find the default programs, but here it is in black and white.

Also noted that if I change the DIRS  to %10111111 then Pin 7 is constantly powered up as well.  Ok, that makes sense, but how do I trigger header pins to operate a device? 
Thank you all again. 

                     '
'   File......      Relay
'   Purpose...      5 seconds of light, then 5 more seconds fogger
'   Author....      Steve
'   E-mail....
'   Started...      2018
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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



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


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

SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Relay           = PIN5                  ' No set up
SYMBOL  Solonoid        = PIN2                  ' activate solonoid


' -----[ Constants ]-------------------------------------------------------
SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  TrOn            = 1                     ' active-high trigger
SYMBOL  TrOff           = 0

SYMBOL  IsOn            = 1                     ' active-high I/O
SYMBOL  IsOff           = 0



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

  SYMBOL  timer           = B2                    ' for debounce loop


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

Power_Up:
  PAUSE 3000                                    ' let Prop 1 initialize

Reset:
  PINS = %00100000                              ' P5 is output
  DIRS = %00111111                              ' P5..P0 are outputs

  PAUSE 30000                                   ' PIR warm-up/delay


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

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  PAUSE 5                                       ' scan delay
  IF Trigger = TrOff THEN Main                  ' check trigger input
    timer = timer + 5                           ' update timer
  IF timer < 100 THEN Check_Trigger             ' check timer

  T00:
  Solonoid     = IsOn                           ' activate cylinder
  PAUSE 5000                                    ' solonoid on for 5 seconds

  T05:
  Relay      = IsOn                             ' relay activated
  PAUSE 5000                                    ' relay is on for 5 seconds

  GOTO Reset

aquawilly54

...and the story continues.  A bit of a conundrum here:  I put the trainer on the prop 1.  It indicates that the header pins are working great so then why is it that when I hook up a serial connector to any of the header pins they are immediately powering up the device?  I figured with all of the P7 issues I'd just run from P4, but it won't let me.  The trainer however says otherwise.  What's going on? 

Here's the code again.  I configured pin 4 to IsOff immediately, then turn on, but still it remains powered, unless the trainer is on. 

I have always used "pin" for the OUT signals, so do I need to use something else for the header pins?
Help me please.

Steve
                     '
'   File......      Relay
'   Purpose...      5 seconds of light, then 5 more seconds fogger
'   Author....      Steve
'   E-mail....
'   Started...      2018
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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



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


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

SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Relay           = PIN4                  ' No set up
SYMBOL  Solonoid        = PIN2                   ' activate solonoid


' -----[ Constants ]-------------------------------------------------------
SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  TrOn            = 1                     ' active-high trigger
SYMBOL  TrOff           = 0

SYMBOL  IsOn            = 1                     ' active-high I/O
SYMBOL  IsOff           = 0



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

  SYMBOL  timer           = B2                    ' for debounce loop


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

Power_Up:
  PAUSE 3000                                    ' let Prop 1 initialize

Reset:
  PINS = %00000000                              ' P4 is output
  DIRS = %00111111                              ' P5..P0 are outputs

  PAUSE 30000                                   ' PIR warm-up/delay


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

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  PAUSE 5                                       ' scan delay
  IF Trigger = TrOff THEN Main                  ' check trigger input
    timer = timer + 5                           ' update timer
  IF timer < 100 THEN Check_Trigger             ' check timer

  T00:
  Relay      = IsOff
  Solonoid     = IsOn                           ' activate cylinder
  PAUSE 5000                                    ' solonoid on for 5 seconds

  T05:
  Relay      = IsOn
  PAUSE 5000
  GOTO Reset

JonnyMac

Can you explain, in plain English (no code), exactly what behavior you're looking for? Be very specific. What are you connecting to? This thread seems to have started in the middle which has me very confused.
Jon McPhalen
EFX-TEK Hollywood Office