November 23, 2024, 04:44:41 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.


Table based light chaser-sequencer

Started by jukingeo, May 02, 2010, 07:38:29 AM

Previous topic - Next topic

jukingeo

May 02, 2010, 07:38:29 AM Last Edit: May 03, 2010, 07:24:49 AM by jukingeo
Hello all,

As you may or may not know, being an avid Prop-2 programmer, I decided to finally take the dive into the world into the Prop-1.   While I am getting to know the micro-controller, I am practicing by converting the many Prop-2 programs over.

One of my favorite programs is a table program or drum sequencer.   The nice thing about a program like this is that it uses an EEPROM data storage area so that all you have to do is visualize the on/off states within the sequence.

I wanted to see if there were examples like this for the Prop-1, but was surprised to to find much on EEPROM chasers already here.  So naturally I decided to make my own program from scratch (see code below and then come back here).

However, all is not well in EEPROM land and something went wrong.

The program is supposed to chase the LEDS on my Prop-1 trainer in sequence, but what is happening is that the first position (%000001) stays on for at least twice as long as it it should and then it only turns on the EVEN numbered LEDS (0,2,4).  The odd LEDS stay dark.

So I really don't know what went wrong.

Here is the program:

' =========================================================================
'
'   File......  EEPROM chaser
'   Purpose...  Test Read command for light chaser purposes
'   Author....  jukingeo
'   E-mail....
'   Started...  5-2-2010
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

' SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
' SYMBOL  Trigger         = PIN6                  ' SETUP = DN



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

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

' SYMBOL  Baud            = OT2400


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

SYMBOL  position        = B2                    ' EEPROM position
SYMBOL  ledOut          = B3                    ' Led Outputs


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

Reset:
 PINS = %00000000                              ' clear all outputs
 DIRS = %00111111                              ' make P0-P5 outputs


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

Main:

 FOR position = 1 TO 6                         ' position pointer
   READ position, ledOut                       ' get led output
   HIGH ledOut                                 ' turn on LEDs
   PAUSE 250                                   ' pause
   LOW ledOut                                  ' turn off led
 NEXT
                                               ' rinse & repeat
 GOTO Main


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


' -----[ EEPROM ]-------------------------------------------------------

Chase_Sequence:

 EEPROM (%000001, %000010, %000100, %001000, %010000, %100000)

JonnyMac

May 02, 2010, 09:39:49 AM #1 Last Edit: May 02, 2010, 09:47:46 AM by JonnyMac
You have two problems:

1) EEPROM tables start at address 0; your loop starts at address 1.
2) HIGH and LOW are not appropriate for parallel outputs -- you must write to the PINS group (all outputs).

Here's your Main loop that works; I'll leave it to you to study and learn from (there's a couple tricks).

Main:
 FOR position =
0 TO 5                         ' position pointer
   READ position, ledOut                       ' get led output

   PINS = PINS & %11000000 | ledOut            ' output pattern
   PAUSE 250                                   ' pause

   PINS = PINS &/ ledOut                       ' turn off led
 NEXT                                          ' rinse & repeat
 GOTO Main


The reason your version behaved the way it did is because the program was, essentially, attempting to doing this:

 HIGH 2
 PAUSE 250
 LOW 2

 HIGH 4
 PAUSE 250
 LOW 4

  etc....

You could insert a DEBUG statement after reading the table element to prove this to yourself.

BTW... I've written dozens of table-based light chasers for the BS1; in fact, just a few weeks ago I wrote a customized table-based chaser program (which included a trigger and time-out) for a world-famous magician (the program is for a prop).
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

May 02, 2010, 01:07:24 PM #2 Last Edit: May 02, 2010, 02:06:26 PM by jukingeo
Quote from: JonnyMac on May 02, 2010, 09:39:49 AM
You have two problems:

1) EEPROM tables start at address 0; your loop starts at address 1.

Yeah, I wasn't sure and I did try it both ways, but when it still wasn't working right, I knew I had a bigger problem

Quote
2) HIGH and LOW are not appropriate for parallel outputs -- you must write to the PINS group (all outputs).

I had  a funny feeling this was wrong as it didn't seem right.  I knew you can HIGH/LOW a variable, but not to what extent.

Quote

Here's your Main loop that works; I'll leave it to you to study and learn from (there's a couple tricks).

Main:
 FOR position =
0 TO 5                         ' position pointer
   READ position, ledOut                       ' get led output

   PINS = PINS & %11000000 | ledOut            ' output pattern
   PAUSE 250                                   ' pause

   PINS = PINS &/ ledOut                       ' turn off led
 NEXT                                          ' rinse & repeat
 GOTO Main

Ok so with the first red line it looks like you are masking the byte for the output.  Correct?

The second red line clears the led, but what I don't get is the &/ (the slash part).

Quote
The reason your version behaved the way it did is because the program was, essentially, attempting to doing this:

 HIGH 2
 PAUSE 250
 LOW 2

 HIGH 4
 PAUSE 250
 LOW 4

 etc....

You could insert a DEBUG statement after reading the table element to prove this to yourself.

Didn't have to, from what you explained above, I quickly figured out that it was looking at the byte from the actual value rather than the bit positions.  Thus 010 translated to the value "2" and 100 translated to the value 4.  

Quote
BTW... I've written dozens of table-based light chasers for the BS1; in fact, just a few weeks ago I wrote a customized table-based chaser program (which included a trigger and time-out) for a world-famous magician (the program is for a prop).

Understood.  I was initially searching for "Light Chaser or Table Chaser" and, naturally, not much turned up in those searches.  But when I geared my search to "Sequencer", many more options came up.

I actually was reading this thread when I noticed your reply:

http://www.efx-tek.com/php/smf/index.php?topic=734.0

In particular I was looking at this program you wrote (2nd one down in the thread above).

' =========================================================================
'
'   File...... ClaytonFearFarm_Prop-1_Sound_RC4.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'   Started... xmas candel ver2
'   Updated... 04 SEP 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Triggered, table-drive sequencer capable of driving six control outputs
' on RC-4 relay boards.  Outputs 0-3 go to RC-4 %00, outputs 4-5 go to
' RC-4 %01.
'
' P6 is used as the trigger input.
'
' Note: Replace ULN2803 with ULN2003 to allow serial comms with AP-8
' (on P7).  The RC-4s must be placed between the Prop-1 and the AP-8.
'
' [Prop-1]--->[RC-4 %00]--->[RC-4 %01]--->[AP-8]


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN


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

SYMBOL  IsOn            = 1                     ' for active-high input
SYMBOL  IsOff           = 0

SYMBOL  TicTiming       = 40                    ' 0.1 sec per step


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

SYMBOL  showBits        = B0
SYMBOL   playAudio      =  BIT6
SYMBOL   endOfShow      =  BIT7

SYMBOL  relays          = B1                    ' RC-4 relay data
SYMBOL   K1a            =  BIT0                 ' RC-4 %00 K1
SYMBOL   K2a            =  BIT1                 ' RC-4 %00 K2
SYMBOL   K3a            =  BIT2                 ' RC-4 %00 K3
SYMBOL   K4a            =  BIT3                 ' RC-4 %00 K4
SYMBOL   K1b            =  BIT4                 ' RC-4 %01 K1
SYMBOL   K2b            =  BIT5                 ' RC-4 %01 K2

SYMBOL  pntr            = B2                    ' step pointer
SYMBOL  tix             = B3


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

Reset:
 PINS = %00000000                              ' clear pins
 DIRS = %00000000                              ' no local outputs

 SEROUT Sio, OT2400, ("!!!!!!!AP8", %00, "X")  ' kill sound if reset
 SEROUT Sio, OT2400, ("!RC4", %00, "X")        ' kill RC-4s
 SEROUT Sio, OT2400, ("!RC4", %01, "X")
 pntr = 0                                      ' point to start of show


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

Main:
 IF Trigger = IsOff THEN Main                  ' wait for trigger

Play_Show:
 READ pntr, showBits                           ' get step

Check_Sound:
 IF playAudio = IsOff THEN Engine
   SEROUT Sio, OT2400, ("!AP8", %00, "P", 0)   ' start the sound

Engine:
 relays = showBits & %00111111                 '   update outputs
 SEROUT Sio, OT2400, ("!RC4", %00, "S", relays)
 relays = relays / 16
 SEROUT Sio, OT2400, ("!RC4", %01, "S", relays)
 pntr = pntr + 1                               '   point to timing
 READ pntr, tix                                '   read it
 GOSUB Run_Timer                               '   run the timer
 pntr = pntr + 1                               '   point to next step

 IF endofShow = IsOn THEN Reset                '   done?
   GOTO Play_Show


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

Run_Timer:
 IF tix = 0 THEN Timer_Done                    ' timer expired?
   PAUSE TicTiming                             ' no, time on "tic"
   tix = tix - 1                               ' decrement timer
   GOTO Run_Timer                              ' check again

Timer_Done:
 RETURN

' -----[ EEPROM Data ]-----------------------------------------------------

Show_Data:
'          +------------ end of show bit
'          |+----------- start audio player, not used
'          ||+---------- 6 candle
'          |||+--------- 5 candle
'          ||||+-------- 4 candle
'          |||||+------- 3 candle
'          ||||||+------ 2 candle
'          |||||||+----- 1 candle
'          ||||||||
'          ||||||||  +-- timing (1 to 255)

 EEPROM (%00000000, 0)                         ' start audio
 EEPROM (%00001001, 1)
 EEPROM (%00010010, 1)
 EEPROM (%00100100, 1)
 EEPROM (%00100100, 1)
 EEPROM (%00010010, 1)
 EEPROM (%00100100, 1)
 EEPROM (%00001001, 1)
 EEPROM (%00010010, 1)
 EEPROM (%00101101, 1)
 EEPROM (%00111111, 1)
 EEPROM (%00010010, 1)
 EEPROM (%00100100, 1)
 EEPROM (%00001001, 1)
 EEPROM (%00010010, 1)
 EEPROM (%00100100, 1)
 EEPROM (%00101101, 1)
 EEPROM (%00010010, 1)
 EEPROM (%00100100, 1)
 EEPROM (%00001001, 1)
 EEPROM (%00010010, 1)
 EEPROM (%00100100, 1)
 EEPROM (%00111111, 1)
 EEPROM (%00010010, 1)
 EEPROM (%00100100, 1)
 EEPROM (%00000000, 0)                         ' inter-show delay
 EEPROM (%10000000, 0)                         ' show done



Now in this program the question I have is in the 'Engine Section':

Engine:
 relays = showBits & %00111111                 '   update outputs
 SEROUT Sio, OT2400, ("!RC4", %00, "S", relays)
 relays = relays / 16
 SEROUT Sio, OT2400, ("!RC4", %01, "S", relays)
 pntr = pntr + 1                               '   point to timing
 READ pntr, tix                                '   read it
 GOSUB Run_Timer                               '   run the timer
 pntr = pntr + 1                               '   point to next step



Ok, so I see the first part is the bit masking.   But two lines down I see the line 'relays = relays /16'.  I am not fully sure what that is for.   Is it for the timing part of the EEPROM data?

Thanx,
Geo




jukingeo

May 02, 2010, 02:04:23 PM #3 Last Edit: May 02, 2010, 02:17:10 PM by jukingeo
Hello all,

Ok everyone, here is the fixed chaser program.  I replaced my my 'bum' main section with Jon's corrected main section.   I have also added a Pot section and put in a more interesting 3on/3off chase pattern.  This herein lies the beauty of a program like this in that you can easily change the pattern just by visualizing the data in the EEPROM section.  NOTE if you increase / decrease the number of steps you must alter the FOR NEXT loop's first line "FOR position = 0 to 5" line by changing the end value to match the number of steps in the EEPROM section.  E.G.  If you want to input a 12 position pattern the line should read:

FOR position = 0 to 11

Enjoy!

Geo

' =========================================================================
'
'   File......  EEPROM chaser
'   Purpose...  Test Read command for light chaser purposes
'   Author....  jukingeo
'   E-mail....
'   Started...  5-2-2010
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  speed            = 7                     ' SETUP = UP; no ULN
' SYMBOL  Trigger         = PIN6                  ' SETUP = DN



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

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

' SYMBOL  Baud            = OT2400


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

SYMBOL  position        = B2                    ' EEPROM position
SYMBOL  ledOut          = B3                    ' Led Outputs
SYMBOL  delay           = B4                    ' speed delay

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

Reset:
 PINS = %00000000                              ' clear all outputs
 DIRS = %00111111                              ' make P0-P5 outputs


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

Main:
 FOR position = 0 TO 5                         ' position pointer
   READ position, ledOut                       ' get led output
   PINS = PINS & %11000000 | ledOut            ' output pattern
   PAUSE delay                                 ' pause
   PINS = PINS &/ ledOut                       ' turn off led
 NEXT

 POT Speed, 255, delay
 delay = delay / 1                             ' set new range

GOTO Main                                       ' rinse & repeat


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


' -----[ EEPROM ]-------------------------------------------------------

Chase_Sequence:

 EEPROM (%000111, %001110, %011100, %111000, %110001, %100011)


Now the next improvement I would like to do to this program would be to use the button on the Prop-Trainer to step through different groups of EEPROM data.   I know this was pretty easy to do with the Prop-2 because you can reference the DATA sections via the labels, but you can't do that with the Prop-1.  So the question remains IF it can be done on the Prop-1.

Thanx,

Geo

JonnyMac

It can be done in the Prop-1, albeit, manually.  That is, you have to count addresses and manually enter them into your code (using LOOKUP is handy for this).
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

Quote from: JonnyMac on May 02, 2010, 09:41:16 PM
It can be done in the Prop-1, albeit, manually.  That is, you have to count addresses and manually enter them into your code (using LOOKUP is handy for this).

Hello Jon,

I was afraid you were going to say that as I was thinking the same thing.  The problem with this though is if you change the NUMBER of steps in a section, you throw the whole count off.   With the Prop-2 you had the DATA labels and you could jump to the correct section via the label.

I guess what I could do is scale the project down from a Prop-2 project and just set a fixed number of steps and just mention that those step numbers shouldn't be changed and that that you would double up on smaller patterns.

Basically what was trying to do is get somewhat a Prop-1 version of this program you helped me with for the Prop-2 (please ignore the syntax for now, I was trying to convert this over to a Prop-1 and stopped midway.  So for others reading this DO NOT put this into your  Prop-1, it isn't ready yet):

' =========================================================================
'
'   File...... Pattern_Chaser_v6.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'   Revised by Jukin'Geo (added auto pattern change timing loop)
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Speed            = 7                      ' SETUP = DN, no ULN
SYMBOL  PatSelect        = PIN6                   ' SETUP = DN
SYMBOL  Leds             = B3


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

SYMBOL  IsOn             = 1
SYMBOL  IsOff            = 0

SYMBOL  Pressed          = 1
SYMBOL  NotPressed       = 0

SYMBOL  timeselect       = 300                     'set time for pattern change


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

SYMBOL  patNum     = B2                     ' pattern, 0 - 3
SYMBOL  pntr       = W2                   ' start of pattern
SYMBOL  offset     = B6                    ' offset into pattern
SYMBOL  patLen     = B7                    ' length of pattern
SYMBOL  patbuf     = W4                    ' pattern time buffer

SYMBOL  delay      = W5


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

Reset:
  DIRS  = %00111111                             ' make LEDs outputs


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

Main:

FOR patbuf = 1 TO timeselect                    ' auto pattern change
  IF (PatSelect = Pressed) THEN                 ' button pressed?
    Leds = %000000                              ' clear to indicate press
    patNum = patNum + 1 // 7                    ' point to next pattern
    offset = 0                                  ' reset to start
    ENDIF

  LOOKUP patNum, [Pattern1, Pattern2, Pattern3, Pattern4, Pattern5, Pattern6, Pattern7], pntr
  LOOKUP patNum, [10, 20, 6, 6, 3, 5, 40], patLen

  READ pntr + offset, Leds                      ' update LEDs
  offset = offset + 1 // patLen                 ' adjust offset

Speed_Delay:
  HIGH Speed                                    ' charge RC circuit
  PAUSE 1
  POT Speed, 1, delay                        ' read raw delay
  delay = delay / 3 + 50                        ' set new range
  PAUSE delay                                   ' hold a bit

NEXT

patNum = patNum + 1 // 7

GOTO main


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


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

Pattern1       EEPROM   %000001        'Cylon Eye
               EEPROM   %000010
               EEPROM   %000100
               EEPROM   %001000
               EEPROM   %010000
               EEPROM   %100000
               EEPROM   %010000
               EEPROM   %001000
               EEPROM   %000100
               EEPROM   %000010

Pattern2       EEPROM   %000001       'KITT - Knight Rider
               EEPROM   %000011
               EEPROM   %000111
               EEPROM   %001111
               EEPROM   %011111
               EEPROM   %111111
               EEPROM   %111110
               EEPROM   %111100
               EEPROM   %111000
               EEPROM   %110000
               EEPROM   %100000
               EEPROM   %110000
               EEPROM   %111000
               EEPROM   %111100
               EEPROM   %111110
               EEPROM   %111111
               EEPROM   %011111
               EEPROM   %001111
               EEPROM   %000111
               EEPROM   %000011

Pattern3       EEPROM   %000001       'Standard 6 Chan Chase
               EEPROM   %000010
               EEPROM   %000100
               EEPROM   %001000
               EEPROM   %010000
               EEPROM   %100000

Pattern4       EEPROM   %001110       '3-on 3-off Chase
               EEPROM   %011100
               EEPROM   %111000
               EEPROM   %110001
               EEPROM   %100011
               EEPROM   %000111

Pattern5       EEPROM   %100001       'In to center 3 Chan Chase
               EEPROM   %010010
               EEPROM   %001100

Pattern6       EEPROM   %001100       'Out from center 3 Chan Chase
               EEPROM   %011110
               EEPROM   %111111
               EEPROM   %110011
               EEPROM   %100001

Pattern7       EEPROM   %000001       '6 Letter Theatre Marquee
               EEPROM   %000011
               EEPROM   %000111
               EEPROM   %001111
               EEPROM   %011111
               EEPROM   %111111
               EEPROM   %111111
               EEPROM   %000001
               EEPROM   %000011
               EEPROM   %000111
               EEPROM   %001111
               EEPROM   %011111
               EEPROM   %111111
               EEPROM   %111111
               EEPROM   %000001
               EEPROM   %000011
               EEPROM   %000111
               EEPROM   %001111
               EEPROM   %011111
               EEPROM   %111111
               EEPROM   %111111
               EEPROM   %111111
               EEPROM   %000000
               EEPROM   %000000
               EEPROM   %111111
               EEPROM   %111111
               EEPROM   %111111
               EEPROM   %111111
               EEPROM   %000000
               EEPROM   %000000
               EEPROM   %111111
               EEPROM   %111111
               EEPROM   %111111
               EEPROM   %111111
               EEPROM   %111110
               EEPROM   %111100
               EEPROM   %110000
               EEPROM   %100000
               EEPROM   %000000
               EEPROM   %000000


To this day this is still one of my favorite programs you came up with for me.  I use this one quite often on the Prop-2.  These programs and the drum sequencers I use often.

BTW, I wanted to ask you if there was a book out there similar to Stamp Works for the Prop-1?   I found the book in my Basic Stamps documents folder and I was happy to finally recover the file as I remembered learning quite a bit from it for the Prop-2, but then I realized it was just BS-2 oriented.

My big problems transitioning over to the Prop-1 is how certain issues are handled, such as Read/EEPROM (Prop-1) v.s. Read/Data (Prop-2) and what can and cannot be done.  Same thing with the LOOKUP command.   There are more restrictions working with the Prop-1 and my guess it is easier to transition from the Prop-1 to Prop-2 than going backwards as I am doing.

BUT I am hoping to get the Prop-1 down soon because after this comes the PROPELLER!  Yup!  I can't wait to see what EFX-TEK has to offer with that chip in the future. 

Anyway, thanx again for the help and info, it is always much appreciated.

Geo

JonnyMac

Remember, the BS2 came after the BS1 so many of the inconveniences of the BS1 were eliminated in the BS2.  So... if you started with the BS2 and want to go back to a smaller processor, you just have to live with them.  It's not hard, and will make you write cleaner code to fit your process into such a small space. 

Do me a favor and remove my name from any program you modify -- or at least make it secondary.  I don't want to take credit for your modifications, or get blamed for any mistakes!  ;D
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

In the future, please be careful about posting WIPs that don't work -- in your detailed postings (that many will skim) the point that the program doesn't work may be missed.  If you need assistance with non-working code, just attach it as a file.

Here's that program, back-dated (as it were) to work on the Prop-1.  It works.  Study it for changes I've made and try to deduce my logic for the changes.

' =========================================================================
'
'   File...... Pattern_Chaser_v6.BS1
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'   Revised by Jukin'Geo (added auto pattern change timing loop)
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Speed           = 7                     ' no SETUP, no ULN
SYMBOL  PatSelect       = PIN6                  ' SETUP = DN
SYMBOL  Leds            = PINS


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

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0

SYMBOL  Pressed         = 1
SYMBOL  NotPressed      = 0

SYMBOL  TimeSelect      = 300                   ' set time for pattern change


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

SYMBOL  patNum          = B2                    ' pattern, 0 - 3
SYMBOL  pntr            = B3                    ' start of pattern
SYMBOL  offset          = B4                    ' offset into pattern
SYMBOL  patLen          = B5                    ' length of pattern
SYMBOL  delay           = B7

SYMBOL  patBuf          = W5                    ' auto change timer


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

Reset:
 DIRS  = %00111111                             ' make LEDs outputs


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

Main:
 FOR patbuf = 1 TO TimeSelect                  ' auto pattern change
   IF PatSelect <> Pressed  THEN Get_Parms     ' button pressed?
     Leds = %000000                            ' clear to indicate press
     patNum = patNum + 1 // 7                  ' point to next pattern
     offset = 0                                ' reset to start
     patbuf = 1                                ' reset auto change timer

Force_Release:
   IF PatSelect = Pressed THEN Force_Release

Get_Parms:
   LOOKUP patNum, (0, 10, 30, 36, 42, 45, 50), pntr
   LOOKUP patNum, (10, 20, 6, 6, 3, 5, 40), patLen

   pntr = pntr + offset                        ' point to current element
   READ pntr, Leds                             ' update LEDs
   offset = offset + 1 // patLen               ' adjust offset

Speed_Delay:
   POT Speed, 100, delay                       ' read raw delay
   delay = delay MIN 50                        ' set new range
   PAUSE delay                                 ' hold a bit

 NEXT
 patNum = patNum + 1 // 7

 GOTO Main


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


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

Pattern1:      EEPROM (%000001)                 ' Cylon Eye
              EEPROM (%000010)
              EEPROM (%000100)
              EEPROM (%001000)
              EEPROM (%010000)
              EEPROM (%100000)
              EEPROM (%010000)
              EEPROM (%001000)
              EEPROM (%000100)
              EEPROM (%000010)

Pattern2:      EEPROM (%000001)                 ' KITT - Knight Rider
              EEPROM (%000011)
              EEPROM (%000111)
              EEPROM (%001111)
              EEPROM (%011111)
              EEPROM (%111111)
              EEPROM (%111110)
              EEPROM (%111100)
              EEPROM (%111000)
              EEPROM (%110000)
              EEPROM (%100000)
              EEPROM (%110000)
              EEPROM (%111000)
              EEPROM (%111100)
              EEPROM (%111110)
              EEPROM (%111111)
              EEPROM (%011111)
              EEPROM (%001111)
              EEPROM (%000111)
              EEPROM (%000011)

Pattern3:      EEPROM (%000001)                 ' Standard 6 Chan Chase
              EEPROM (%000010)
              EEPROM (%000100)
              EEPROM (%001000)
              EEPROM (%010000)
              EEPROM (%100000)

Pattern4:      EEPROM (%001110)                 ' 3-on 3-off Chase
              EEPROM (%011100)
              EEPROM (%111000)
              EEPROM (%110001)
              EEPROM (%100011)
              EEPROM (%000111)

Pattern5:      EEPROM (%100001)                 ' In to center 3 Chan Chase
              EEPROM (%010010)
              EEPROM (%001100)

Pattern6:      EEPROM (%001100)                 ' Out from center 3 Chan Chase
              EEPROM (%011110)
              EEPROM (%111111)
              EEPROM (%110011)
              EEPROM (%100001)

Pattern7:      EEPROM (%000001)                 ' 6 Letter Theatre Marquee
              EEPROM (%000011)
              EEPROM (%000111)
              EEPROM (%001111)
              EEPROM (%011111)
              EEPROM (%111111)
              EEPROM (%111111)
              EEPROM (%000001)
              EEPROM (%000011)
              EEPROM (%000111)
              EEPROM (%001111)
              EEPROM (%011111)
              EEPROM (%111111)
              EEPROM (%111111)
              EEPROM (%000001)
              EEPROM (%000011)
              EEPROM (%000111)
              EEPROM (%001111)
              EEPROM (%011111)
              EEPROM (%111111)
              EEPROM (%111111)
              EEPROM (%111111)
              EEPROM (%000000)
              EEPROM (%000000)
              EEPROM (%111111)
              EEPROM (%111111)
              EEPROM (%111111)
              EEPROM (%111111)
              EEPROM (%000000)
              EEPROM (%000000)
              EEPROM (%111111)
              EEPROM (%111111)
              EEPROM (%111111)
              EEPROM (%111111)
              EEPROM (%111110)
              EEPROM (%111100)
              EEPROM (%110000)
              EEPROM (%100000)
              EEPROM (%000000)
              EEPROM (%000000)
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

Quote from: JonnyMac on May 03, 2010, 10:36:09 AM
In the future, please be careful about posting WIPs that don't work -- in your detailed postings (that many will skim) the point that the program doesn't work may be missed.  If you need assistance with non-working code, just attach it as a file.

Sorry about that.  I actually was trying to convert that one myself prior to one you fixed earlier.

Quote
Here's that program, back-dated (as it were) to work on the Prop-1.  It works.  Study it for changes I've made and try to deduce my logic for the changes.

Once again...many thanx.  That was always a favorite program. 

I have to see if I can find a good book like the Stamp Works book (I used for the BS-2) that covers the BS-1.  Would you have any recommendations?

Thank You,

Geo

JonnyMac

There is no StampWorks type book for the BS1.  Your best bet is reading the Nuts & Volts articles written by me and others -- lots of interesting stuff and with three authors (Scott Edwards, Lon Glazner, me) you get different programming perspectives that may be useful.
Jon McPhalen
EFX-TEK Hollywood Office

bsnut

May 03, 2010, 05:40:49 PM #10 Last Edit: May 03, 2010, 05:44:32 PM by bsnut
Heres a book that I look at, if I need help with basic programming.
"Programming and Customizing The Basic Stamp Computer" by Scott Edwards

or this one
"Pic Microcontroller Project Book" by John Iovine

These books help me all the time, so you may want to look into reading.
William Stefan
The Basic Stamp Nut

jukingeo

Quote from: JonnyMac on May 03, 2010, 01:00:33 PM
There is no StampWorks type book for the BS1.  Your best bet is reading the Nuts & Volts articles written by me and others -- lots of interesting stuff and with three authors (Scott Edwards, Lon Glazner, me) you get different programming perspectives that may be useful.

Ok, thanx, I found those files in the Prop-1 resources earlier today.  I will probably spend most of the week going over those.

Thanx again for the help with the chaser program...glad to see that it runs just as nice on the Prop-1 as it does on the Prop-2.  Moreover it fits with PLENTY of room left over in EEPROM space.  As it stands the program only uses 66% of the memory.

Quote from: bsnut on May 03, 2010, 05:40:49 PM
Heres a book that I look at, if I need help with basic programming.
"Programming and Customizing The Basic Stamp Computer" by Scott Edwards

or this one
"Pic Microcontroller Project Book" by John Iovine

These books help me all the time, so you may want to look into reading.

Thanx...I see that Amazon has the Scott Edwards book and I recognize the cover.  I think I must have had that book in my hands once or twice when I was at Borders.

Geo