SteveB's code is exactly what you're looking for. You can make it even
smaller/faster by reading each value in the list directly onto the port.
Run this to see how it works.
Code:
Patt1 data 8,1,2,4,8,16,32,64,128
Patt2 data 8,128,64,32,16,8,4,2,1
steps VAR BYTE
counts VAR BYTE
temp VAR BYTE
TRISB = 0
MAIN:
READ Patt1, steps ' get number of EEPROM entries
FOR counts = 1 TO steps
READ (Patt1+counts), PORTB
PAUSE 50
NEXT counts
' now cycle LED's back the other way
READ Patt2, steps ' get number of EEPROM entries
FOR counts = 1 TO steps
READ (Patt2+counts), PORTB
PAUSE 50
NEXT counts
GOTO MAIN
END
When you give each line a label you can just reference the label name to find
the starting point or base address of each pattern in EEPROM.
Patt1 starts at the first available location in EEPROM. Patt2 starts at the next
available location after the last byte in Patt1.
You don't need to know the physical address of each pattern because each
one has already been assigned a label. Each label is a pointer to the base
address of each separate pattern in EEPROM.
Bookmarks