[Can anyone see a problem with it? ]
Yes. The conditional statement needs to be on one line as WestAust demonstrated. However a little known
but very useful feature feature is the "line continuation character" This is the underscore character _.
IF you want to break it up into separate lines, it can be done like this: Note the use of the line continuation character.
Code:
if b11 = 0 and _
b12 = 6 and _
b13 = 0 and _
b14 = 0 then
switchon C.0
endif
But IMO the preferred and most common method would be all on the same line UNLESS the line is so long that it wont fit on the page.
"Switch on /off " is a pseudo command provided for the the kiddies in grade school.
Most of the big boys use "high" or "low".
When a Pin is being used as an output to turn something on or off (switchon/off, high, low, pulsout, etc) , do not put "Pin" before the port.pin constant. Just use "C.0".
"PinC.0" is used when the pin is an input and the code is testing the state of the Pin. eg. "If pinc.2 = 0 then goto main"
I can't tell you why your gosub or goto would not work, but I suspect it was related to a syntax error. Here is how I would write your example using a Gosub.
Code:
[color=Navy]#Picaxe [/color][color=Black]20X2 [/color][color=Green]'This directive tells folks what chip is used [/color]
[color=Blue]Symbol RED_LED [/color][color=DarkCyan]= [/color][color=Blue]B.0 [/color][color=Green]'Symbols make code easier to read
'Note: Commenting Code is necessary for others to
' understand what you are trying to do. [/color]
[color=Black]MAIN: [/color][color=Green]'This is the main loop [/color]
[color=Blue]Do
If [/color][color=Purple]b11 [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=DarkCyan]and [/color][color=Purple]b12 [/color][color=DarkCyan]= [/color][color=Navy]6 [/color][color=DarkCyan]and [/color][color=Purple]b13 [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=DarkCyan]and [/color][color=Purple]b14 [/color][color=DarkCyan]= [/color][color=Navy]0 [/color][color=Blue]then
Gosub [/color][color=Black]LED_ON
[/color][color=Blue]Else
gosub [/color][color=Black]LED_OFF
[/color][color=Blue]Endif
Loop[/color]
[color=Green]' ======= Sub routines start here ======== [/color]
[color=Black]LED_ON:
[/color][color=Blue]High RED_LED [/color][color=Green]'Turn the Led On [/color]
[color=Blue]Return[/color]
[color=Black]LED_OFF:
[/color][color=Blue]Low RED_LED [/color][color=Green]'Turn the LED OFF[/color]
[color=Blue]Return [/color]