There are other possibilities with “for next” loops. Just to name a few see code below.
<code><pre><font size=2 face='Courier'> #picaxe 08M
#terminal 9600
symbol LS_Nibble = b2
symbol MS_Nibble = b3
let b6 = 2
setfreq m8
for b0 = "z" to "a" step - b6
sertxd (b0)
'pause 100
next
sertxd (CR,LF)
for b0 = $FF to $00 step - b6
gosub convert
sertxd ("Hex = $",MS_Nibble,LS_Nibble,CR,LF)
'pause 100
next
for b0 = "A" to "Z"
sertxd (b0)
'pause 100
next
sertxd (CR,LF)
for b0 = %11111111 to %00000000 step - %00000010
sertxd ("Bin = %",#bit7,#bit6,#bit5,#bit4,#bit3,#bit2,#bit1,#bit0,CR,LF)
'pause 100
next
end
convert:
let LS_Nibble = b0 & %00001111
let MS_Nibble = b0 & %11110000 / 16
lookup LS_Nibble,("0123456789ABCDEF"
,LS_Nibble
lookup MS_Nibble,("0123456789ABCDEF"
,MS_Nibble
return </font></pre></code>