Syntax errors

kmp24

New Member
The Microcontrollers program keeps telling me that i have a syntax error in my program, but the same commands have worked in other programs that i have written, why doesnt this one work.
Code:
Symbol delay = B0
delay = 100  

main: 

high 0            
pause delay       
low 0  
high 1
pause delay       
low 1             
high 2            
pause delay       
low 2             
high 3             
pause delay       
low 3             
goto main3:

main2:
 

high 3             
pause delay       
low 3              
high 2             
pause delay       
low 2             
high 1          
pause delay        
low 1               
high 0             
pause delay        
low 0               
goto main3     
         
main3:   

if pin4 = 0 then main4 
if pin5 = 0 then main5 
if pin6 = 0 then main6
if pin7 = 0 then main7 
goto main       

main4:  

delay = delay + 5  
pause 50          
if delay > 250 then main8 
if pin4 = 0 then main4 
goto main3         

main5:  

delay = delay - 5  
pause 50           
if delay < 20 then main9 
if pin5 = 0 then main5 
goto main3           

main6:    

if pin6 = 0 then halt 
goto main3        

main8:     

delay = 245         
goto main3         

main9:     

delay = 25          
goto main3       
[code]
 

BeanieBots

Moderator
It should highlight the faulty line.
At a quick glance, I can see a jump to label "halt" but I can't find that label anywhere in your code.

After another quick scan, I can't see "main7" anywhere either.
 

kmp24

New Member
those were small errors, the syntax error which the program highlights was "unknown symbol pin4"
 

BeanieBots

Moderator
More than likely it's because you are using an 18X (or at least you've told the edititor that you are).
The 18X does not have a pin4!

Which PICAXE are you using?
Which version of the editor?
 

Mycroft2152

Senior Member
BB, our crystal balls must have been synched! Yup, i was awake very early this morning.

This is a good time to remind any posters to include as much info as possible, at least which PICAXE is being used.

The easiest way to do this is in add

#PICAXE 18X

as a line in the program.

This is just a directive to the interpreter.

Writng readable and understandable programs is another thread.
 
Last edited:
Top