In searching the forum for faster shift out code I came across Hippy's posted suggestion on 26.10.2005. I reads
......................................................................................................
'Untested; fastest way to clock 8 bits out msb first (removing the FOR-NEXT overhead), could be to put it in b0 (MSB of w0) and set b0 (LSB of w0) to $FF. As w0=w0*2 operates the LSB is eventually cleared.
b1 = $A5 'data to send
b0 = $FF
BitLoop:
pin0 = bit15
w0 = w0*2
IF b0 <> 0 THEN BitLoop
'To shift 16 bits out, w0 and another word variable can be used
w0 = $A593 'data to send
w1 - $FFFF
BitLoop:
pinX = bit15
w0 = w0*2
w1 = w1*2
IF w1 <> 0 then BitLoop
......................................................................................................
Would apprciate clarification on the following,
a) pinX = bit15. Substituting any numeral for X when running the code always results in the syntax error 'pin? unknown symbol'
b) In the line reading ...IF b0 <> 0 THEN BitLoop..what are the terms inside the IF....THEN command? Shouldn't there be an = sign somewhere?
I've not found any references in the manuals to pinX or the if ... then terms used here. Are they peculiar to a particular Picaxe model? The thread containing the post makes no limitation. I'm using this as a learning experience with an 08M.
......................................................................................................
'Untested; fastest way to clock 8 bits out msb first (removing the FOR-NEXT overhead), could be to put it in b0 (MSB of w0) and set b0 (LSB of w0) to $FF. As w0=w0*2 operates the LSB is eventually cleared.
b1 = $A5 'data to send
b0 = $FF
BitLoop:
pin0 = bit15
w0 = w0*2
IF b0 <> 0 THEN BitLoop
'To shift 16 bits out, w0 and another word variable can be used
w0 = $A593 'data to send
w1 - $FFFF
BitLoop:
pinX = bit15
w0 = w0*2
w1 = w1*2
IF w1 <> 0 then BitLoop
......................................................................................................
Would apprciate clarification on the following,
a) pinX = bit15. Substituting any numeral for X when running the code always results in the syntax error 'pin? unknown symbol'
b) In the line reading ...IF b0 <> 0 THEN BitLoop..what are the terms inside the IF....THEN command? Shouldn't there be an = sign somewhere?
I've not found any references in the manuals to pinX or the if ... then terms used here. Are they peculiar to a particular Picaxe model? The thread containing the post makes no limitation. I'm using this as a learning experience with an 08M.