
Originally Posted by
Fredrick
Yes thatīs correct.
How do i do an Array and shift bits, do you have an short example?
Got 1 ready now, incomplete but it serves as example, change the shooters var to change lights lit
Code:
@MyConfig = _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON
@MyConfig = MyConfig & _MCLRE_ON & _BOR_OFF
@ __config MyConfig
include "modedefs.bas"
DEFINE OSC 4
PortA = 0
PortB = 0
PortC = 0
TRISA = 1
TRISB = 0
TRISC = %00000000
i var word 'locks up @ 255 with byte
ANSEL = 0
ANSELH = 0
CM1CON0 = 0
CM2CON0 = 0
shooters var byte
total var byte
serout PortA.2,t9600,["enter shooters"]
' too lazy to do input routine
shooters = 2
lookup shooters -1,[1,3,7,15,31],total
main:
portc = 0
'pause 200
for i = total to 255
portC = i
i=i << 1-1
pause 500
next i
i=0
portC = i
pause 500
goto main
end
not a typical array as we normally see them, but it works using pickit2 & lowpin demo board
Bookmarks