porta IF statment

tim griff

I've looked at this for the last hour, any thoughts

I get a syntax error on the following line
if porta pin0 = 1 and porta pin1 = 1 then dcf77

if I remove the second porta clause or change porta to just pin0 = 1 then it's OK

editor 5.1.3 picaxe 28X


Senior Member
It's really an &quot;IF PORTA&quot; command, rather than an IF command with the pins being specified as being on PORTA, thus there should only be one PORTA immediately after the IF and once that appears then all pin references refer to those on PORTA, so -<code><pre><font size=2 face='Courier'> IF PORTA pin0 = 1 AND pin1 = 1 THEN dcf77 </font></pre></code> both pin0 and pin1 will refer to pins on the PORTA.

tim griff

Many thanks - I was going mad trying to work this out. ( It's the final part of my Nixie clock which is set by a radio signal from Frankfurt.... cheers


Technical Support
Staff member
You cannot mix ports on a single line.
To do that you would need to do something like this

'AND porta pin1 and normal pin1
if porta pin1 = 1 then
if pin1 = 1 then
'code here
end if
end if

'OR porta pin1 and normal pin1
if porta pin1 = 1 then jump
if pin1 = 1 then jump
'other code here

'code here