InvaderZim
Senior Member
This one tripped me up:
When you simulate the above code, the values of bit0 and b1 will change depending on what assign statement is being executed.
I like to name my inputs, but using 'symbol Name1 = C.5' doesn't work properly if you then want to use 'b1=Name1' (but it is exactly what you need if you want to 'readadc Name1,b0').
In the past (prior to the port.pin convention) I think this always caused a syntax error (such as '5' vs. 'pin5'), and I dealt with it. This time, there is no syntax error in the code above...but it won't return the results that you expect.
It seems that the compiler shouldn't need to interpret 'b1=C.5' as anything other than 'b1=pinC.5' or am I missing something? Or could it at least generate a syntax error?
Code:
#picaxe 18M2
main:
bit0=C.5
pause 1
b1=C.5
pause 1
bit0=pinC.5
pause 1
b1=pinC.5
pause 1
readadc C.1,b2
pause 1
'readadc pinC.1,b2 'bad syntax
goto main
I like to name my inputs, but using 'symbol Name1 = C.5' doesn't work properly if you then want to use 'b1=Name1' (but it is exactly what you need if you want to 'readadc Name1,b0').
In the past (prior to the port.pin convention) I think this always caused a syntax error (such as '5' vs. 'pin5'), and I dealt with it. This time, there is no syntax error in the code above...but it won't return the results that you expect.
It seems that the compiler shouldn't need to interpret 'b1=C.5' as anything other than 'b1=pinC.5' or am I missing something? Or could it at least generate a syntax error?