Let's Make Robots!

PICAXE 28x1 Syntax Error

I need help, I'm trying to program a sonar with the PICAXE programing editor and tere's this Syntax error that shouldn't be there.

low portc 0
pulsout b.5,5
pause 200
pulsin portc 0, 1, w1
w1 = w1/29

It only complains with the "pulsin" line, the "low" line doen't create any sort of problems. What's wrong here?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Very sorry for not noticing this for a month. Was just reading back to old entries and realised I never saw this one at the time.

Looks like JAX has it covered.

there is a space between your "0." and the following "1." get rid of that :)

 

try this:

low portc 0
pulsout b.5,5
pause 200
pulsin 0,1,w1
w1 = w1/29

I'm betting the low command is for demonstration only but it will turn your c.0 pin into an output. Port C pins start as inputs on powerup. You'll need a DIRSC command before your PULSIN to set it as an input again.

Also, I'm not sure which sonar you're using but a 50us activation pulse is pretty long. Most require around 10us. The following "pause 200" is not necessary. That's almost a quarter second delay. You really want the PULSIN command to be fired up as soon as possible to catch close range objects.

Let us know how it goes.