light show
Archiver
Posts: 46,084
can someone tell me what I am doing wrong. I am trying to make a light show with a bs2p. I am storing the light shows in the eeprom then reading them when I want them here is a snip.
' {$STAMP BS2p}
Lights VAR Outs
index var byte
'other seq
seq3 DATA word %1000000000000001
······ DATA word %0100000000000010
······ DATA word %0010000000000100
······ DATA word %0001000000001000
······ DATA word %0000100000010000
······ DATA word %0000010000100000
······ DATA word %0000001001000000
······ DATA word %0000000110000000
······ DATA word %0000001001000000
······ DATA word %0000010110100000
······ DATA word %0000101001010000
······ DATA word %0001010110101000
······ DATA word %0010101001010100
······ DATA word %0101010110101010
······ DATA word %1010101001010101
····· DATA word %0101010110101010
····· DATA word %1010101001010101
····· DATA word %0101010000101010
····· DATA word %1010100000010101
····· DATA word %0101000000001010
····· DATA word %1010000000000101
····· DATA word %0100000000000010
····· DATA word %1000000000000001
···· DATA word %0000000000000000
main:
for index = 0 to 24
read (seq3 + index),lights.lowbyte
read (seq3 + index),lights.highbyte
pause 500
debug cls,bin lights,cr,dec index
next
goto main
When you run the program you get junk. What am I doing wrong?
Thanks
TC
' {$STAMP BS2p}
Lights VAR Outs
index var byte
'other seq
seq3 DATA word %1000000000000001
······ DATA word %0100000000000010
······ DATA word %0010000000000100
······ DATA word %0001000000001000
······ DATA word %0000100000010000
······ DATA word %0000010000100000
······ DATA word %0000001001000000
······ DATA word %0000000110000000
······ DATA word %0000001001000000
······ DATA word %0000010110100000
······ DATA word %0000101001010000
······ DATA word %0001010110101000
······ DATA word %0010101001010100
······ DATA word %0101010110101010
······ DATA word %1010101001010101
····· DATA word %0101010110101010
····· DATA word %1010101001010101
····· DATA word %0101010000101010
····· DATA word %1010100000010101
····· DATA word %0101000000001010
····· DATA word %1010000000000101
····· DATA word %0100000000000010
····· DATA word %1000000000000001
···· DATA word %0000000000000000
main:
for index = 0 to 24
read (seq3 + index),lights.lowbyte
read (seq3 + index),lights.highbyte
pause 500
debug cls,bin lights,cr,dec index
next
goto main
When you run the program you get junk. What am I doing wrong?
Thanks
TC
Comments
for index = 0 to 24
read (index*2+seq3),lights.lowbyte
read (index*2+1+seq3),lights.highbyte
pause 500
debug cls,bin lights,cr,dec index
next
-- Tracy
>can someone tell me what I am doing wrong. I am trying to make a
>light show with a bs2p. I am storing the light shows in the eeprom
>then reading them when I want them here is a snip.
>
>
>' {$STAMP BS2p}
>
>Lights VAR Outs
>
>index var byte
>
>
>
>'other seq
>
>seq3 DATA word %1000000000000001
>
> DATA word %0100000000000010
>
> DATA word %0010000000000100
>
> DATA word %0001000000001000
>
> DATA word %0000100000010000
>
> DATA word %0000010000100000
>
> DATA word %0000001001000000
>
> DATA word %0000000110000000
>
> DATA word %0000001001000000
>
> DATA word %0000010110100000
>
> DATA word %0000101001010000
>
> DATA word %0001010110101000
>
> DATA word %0010101001010100
>
> DATA word %0101010110101010
>
> DATA word %1010101001010101
>
> DATA word %0101010110101010
>
> DATA word %1010101001010101
>
> DATA word %0101010000101010
>
> DATA word %1010100000010101
>
> DATA word %0101000000001010
>
> DATA word %1010000000000101
>
> DATA word %0100000000000010
>
> DATA word %1000000000000001
>
> DATA word %0000000000000000
>
>
>
>main:
>
>for index = 0 to 24
>
>read (seq3 + index),lights.lowbyte
>
>read (seq3 + index),lights.highbyte
>
>pause 500
>
>debug cls,bin lights,cr,dec index
>
>next
>
>goto main
>
>
>
>When you run the program you get junk. What am I doing wrong?
>
>
>
>Thanks
>
>TC
>
>
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed with. Text in the
>Subject and Body of the message will be ignored.
>
>
>Your use of Yahoo! Groups is subject to the
><http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
aconti@neo.rr.com writes:
The problem is in your main loop. ·You have 23 words (light patterns) defined
in DATA statements, but you can only read them back one byte at a time. ·This
means that your FOR-NEXT loop has to be longer than you expect. ·I like light
controllers so I ran your code. ·This version works the way you want it to:
Main:
·FOR index = 0 TO 46 STEP 2
···READ (Seq3 + index),Lights.LowByte
···READ (Seq3 + index + 1),Lights.HighByte
···PAUSE 500
···DEBUG Home, BIN16 Lights, CR, DEC index
·NEXT
·PAUSE 2000
·GOTO Main
Notice that I modified your DEBUG line a bit. ·By using Home and BIN16, the
details are easier to read.
-- Jon Williams
-- Dallas, TX
-- Applications Engineer, Parallax
[/font]