shiftout

maitchy

Member
I cannot get any shiftout (spiout) command to syntax-check okay - I'm using a 14M and software version 5.1.5 (syntax DLL 131072). I tried the example in manual 2, page 156:
Code:
spiout 1,2,LSB_First, (b1 / 8) ‘ clock 8 bits from b1
(even tried changing LSB_First to a digit or LSBFirst_L etc; tried different pins, old/new compiler syntax, etc.).

It seems spiout is not recognised as a keyword.
 

BCJKiwi

Senior Member
Try it with the "mode" as the number 0,1,4, or 5 not the text "LSBFirst_L" etc.

i.e.
spiout 1,2,1,(b1/8)
or
spiout 1,2,4,(b1/8).
depending on the device requirements.
 

hippy

Ex-Staff (retired)
I couldn't get it to compile for the 14M either, regardless of whatever I changed.

After a lot of faffing about; is it not the case that SHIFTOUT/SPIOUT can only be done with bit-bang GOSUB's except on the the X1's ?

The manual isn't very clear at all, and it does give the impression the command is supported on all PICAXE's, whereas it's not really saying SHIFTOUT/SPIOUT is supported on all those PICAXE's, but that all PICAXE's can be used for bit-banging ( well, like d'uh ! )
 

maitchy

Member
Ah, yes... I see now... I would need an X1 part; the "14M" at the left had be fooled... as you spotted, it is only the subroutines that are relevant to all parts. Thanks!

For what it's worth, my subroutine to do it (which is slightly smaller than the manual's sample code) is:
Code:
‘========================================================================

shiftout_LSBFirst_L:

for counter = 1 to bits
 pin2 = var_out & 1
 var_out = var_out/2
 pulsout sclk,1
next counter
return
(The difficulty in using one symbol for both pin2 here and 2 in other parts of the program is an example of the problem I mentioned in another recent posting, BTW).


Mark
 
Top