Bit Shift - easy one for you :)
I have this bit shift thing that I'm using - it works and I don't have any problems but I want to make sure I'm doing things the best I can
bottom line I want to cycle through a simple bit pattern (%1000) twice
Thanks for any tips to make this any better
Jamie
dira[0..3] := %1111
repeat 2
outa[0..3] := %1000
waitcnt(clkfreq/8 + cnt)
repeat 3
outa[0..3] >>= 1
waitcnt(clkfreq/8 + cnt)
Thanks for any tips to make this any better
Jamie

Comments
rotating a variable past the output window...
[FONT=courier new][SIZE=1]PUB slide | x dira[16..19] := % 1111 x := % 10001000 repeat 8 outa[16..19] := (x ->= 1) waitcnt(clkfreq/8 + cnt)[/SIZE][/FONT]Using the decode operator, |< ...
[FONT=courier new][SIZE=1]PUB slide | x dira[16..19] := % 1111 repeat x from 7 to 0 outa[16..19] := |< (x//4) waitcnt(clkfreq/8 + cnt)[/SIZE][/FONT]dira[0..3] := %1111 pattern := %1000_1000 repeat 8 '2*4 outa[0..3] := pattern waitcnt(clkfreq/8 + cnt) pattern >>= 1Andy
dira[19..16] := %1111 pattern := %1000_1000_1000_1000_1000_1000_1000_1000 repeat 48 '12 * 4 outa[19..16] := pattern waitcnt((clkfreq >> 3) + cnt) pattern ->= 1The books can tell you what things do, and I can figure out how to do something, but I'm just never sure if there are better ways
Jamie