Having struggled with the concepts of pin and outpin, I hope someone can assist.
The following code simulates and runs correctly on chip
However according to these threads (and others)
http://www.picaxeforum.co.uk/showthread.php?9831-Data-Shift-Out
http://www.picaxeforum.co.uk/showthread.php?20369-AXE049-Code-Questions
I interpret the 'preferred' method of referencing an output pin is with the 'outpin' command rather than the 'pin' command.
Manual 2 V7.8 also confirms for an 18M2 the outpinb.0 is a valid command.
However the following version of the code gives a syntax error:
Any advice appreciated.
Malcolm
The following code simulates and runs correctly on chip
Code:
#picaxe 18m2
#no_data
dirsb = %11111111 ;Set port b as output
dirsc = %00000000 ;Set port c as input
symbol dataout = b0 ;w0 and bit 0 to bit 7
symbol pad = b1 ;w0 and bit 8 to bit 15
symbol clock = b.1
symbol strobe = b.2
main:
dataout = %01000000 'data to send
pad = %11111111
low strobe ; Strobe low at start of data
high clock ; Ensure clock is high for pulseout
do
pinb.0 = bit0 ;Make b.0 the value in bit0
w0 = w0/2
pulsout clock,100 ' 100ms clock pulse
loop Until b1 = 0
high strobe ; Strobe high at end of data
goto main
http://www.picaxeforum.co.uk/showthread.php?9831-Data-Shift-Out
http://www.picaxeforum.co.uk/showthread.php?20369-AXE049-Code-Questions
I interpret the 'preferred' method of referencing an output pin is with the 'outpin' command rather than the 'pin' command.
Manual 2 V7.8 also confirms for an 18M2 the outpinb.0 is a valid command.
However the following version of the code gives a syntax error:
outpinb.0 = bit0 ;Make b.0 the value in bit0
^
Error: Unknown symbol - outpinb.0
Code:
#picaxe 18m2
#no_data
dirsb = %11111111 ;Set port b as output
dirsc = %00000000 ;Set port c as input
symbol dataout = b0 ;w0 and bit 0 to bit 7
symbol pad = b1 ;w0 and bit 8 to bit 15
symbol clock = b.1
symbol strobe = b.2
main:
dataout = %01000000 'data to send
pad = %11111111
low strobe ; Strobe low at start of data
high clock ; Ensure clock is high for pulseout
do
outpinb.0 = bit0 ;Make b.0 the value in bit0
w0 = w0/2
pulsout clock,100 ' 100ms clock pulse
loop Until b1 = 0
high strobe ; Strobe high at end of data
goto main
Malcolm