November 23, 2024, 08:31:23 AM

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.


Modify supplied program

Started by GergMN, May 29, 2009, 02:15:11 PM

Previous topic - Next topic

GergMN

I'm just (J-U-S-T) getting started with all of this. I have a Prop-1 and now a USB adapter, so I can finally try out the controller. I'm starting with the "Candles.BS1" program, but want to expand it to use all 8 outputs, rather than the 6 (?) the program uses. How do I do that? I don't quite understand the syntax of the BASIC program, so I don't know which variable to mess with.


EricTheMannn

Here's a link to the prop-1 docs as well, they go over the basics of the prop one which is necessary to go over when first starting, a lot of questions can be answered there http://www.efx-tek.com/downloads/prop-1_docs.pdf  another one  that's handy is the prop-1 programming basics Here's the link they go over the basics of "basic" http://www.efx-tek.com/downloads/prop-1_docs.pdf after looking over those I'd suggest taking a look at these if you're interested in reading a bit more http://www.efx-tek.com/php/smf/index.php?topic=595.0, i found them extremely helpful Programming with style is a good one to start off with. I would try to help with the code, but being at work has its flaws, no stamp editor :/

I hope some of this helps!

-Eric Garthwait
WooHoo

JonnyMac

Since Eric pointed out lots of great links to study I'll show you an update of simple candles program that will output to all eight pins.  Study this listing along with the links and see if you can figure out why it works.  Some things are more art than science, but that will come.  For example, we "stir" the random value three times before sending it to the outputs because it just looks better.  You'll learn these tricks with experience.

' =========================================================================
'
'   File...... Candles_8x.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2009 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Make sure the P6 and P7 SETUP jumpers are out or in the DN position


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


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

SYMBOL  Wicks           = PINS


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

SYMBOL  TmMin           = 25                    ' minimum delay
SYMBOL  TmMax           = 75                    ' maximum delay


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

SYMBOL  idx             = B2
SYMBOL  delay           = B3

SYMBOL  lottery         = W5


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

Reset:
  PINS = %00000000                              ' preset IOs
  DIRS = %11111111                              ' configure IOs

  lottery = 1031                                ' seed random value


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

Main:
  FOR idx = 1 TO 3                              ' stir random value
    RANDOM lottery
  NEXT

  Wicks = lottery

  delay = TmMax - TmMin + 1                     ' calculate span
  delay = lottery // delay + TmMin              ' calculate delay
  PAUSE delay                                   ' wait
  GOTO Main


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


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


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