November 21, 2024, 09:23:41 PM

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.


Programming question, all outputs on?

Started by gadget-evilusions, August 14, 2007, 06:48:31 AM

Previous topic - Next topic

gadget-evilusions

Is there a way to turn all the outputs of the prop-1 on at once, and then off at once. I am making led boards that I will be stobing all on at once and all off at once. P7 is a pot to give me a variable off time between flashes (between 50ms and 1000ms). I belive my on pulse length will only be about 50ms. I have a working program to turn P0 on and off according to my pot, but I couldnt think of an easy way to turn them all on, or all off at once.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

That's an easy one: just write your outputs to the PINS register (renamed Leds in the program below).  Only those pins that are made outputs (by setting the associated bit in DIRS to 1) will be affected.

' =========================================================================
'
'   File...... Flash_Leds.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Speed           = 7                     ' SETUP = out; no ULN
SYMBOL  Leds            = PINS


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

SYMBOL  AllOn           = %01111111
SYMBOL  AllOff          = %00000000

SYMBOL  FlashTiming     = 50


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

SYMBOL  delay           = W5


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

Reset:
  Leds = AllOff                                 ' clear LEDs
  DIRS = %011111111                             ' set outputs


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

Main:
  POT Speed, 110, delay                         ' read speed pot
  delay = delay * 38 / 10 + 35                  ' make ~50 to ~1000 ms
  PAUSE delay
  Leds = AllOn
  PAUSE FlashTiming
  GOTO Reset


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


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


' -----[ EEPROM Data ]-----------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

Oh geez. Now I feel dumb. Thanks for the help Jon.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

Don't kick yourself; you asked, you learned, you're now a better Prop-1 programmer!   ;D
Jon McPhalen
EFX-TEK Hollywood Office