PDA

View Full Version : robot program



ajak
- 8th January 2008, 16:24
can you help me determine the errors of this program?
This is my program for my project in school.. Pls. Help an Reply...

'Braitenberg vehicle 1
b0 var byte
b1 var byte
b2 var byte
start:
pot 1, 255,b0 'Read CdS cell # 1
pot 2, 255,b1 'Read CdS cell # 2
If b0 = b1 then straight
if b0 > b1 then left
if b1 > b0 then right
straight:
high 3: high 4
goto start
left:
b2 = b0 'Compare numerical values +/15
if b2 > 15 then left1 'If greater than 15 turn left
goto straight 'If not go to straight subroutine
left1: 'Turn left
high 3: low 4 'Motor control
goto start
right: 'Compare numerical values +/15
b2 = b1 'If greater then 15 points
if b2 > 15 then right1 'Turn toward the right
goto straight 'If not go straight
right1: 'Turn right
high 4: low 3 'Motor control
goto start 'Do again

sayzer
- 8th January 2008, 16:35
Usually, you won't get replies for this kind of request.

I am on my good day t0day!



b0 var byte
b1 var byte
b2 var byte

start:
pot 1, 255,b0 'Read CdS cell # 1
pot 2, 255,b1 'Read CdS cell # 2
If b0 = b1 then straight
if b0 > b1 then left
if b1 > b0 then right

straight:
high 3
high 4
goto start

left:
b2 = b0 - b1 'Compare numerical values +/15
if b2 > 15 then left1 'If greater than 15 turn left
goto straight 'If not go to straight subroutine

left1: 'Turn left
high 3
low 4 'Motor control
goto start

right: 'Compare numerical values +/15
b2 = b1 - b0 'If greater then 15 points
if b2 > 15 then right1 'Turn toward the right
goto straight 'If not go straight

right1: 'Turn right
high 4
low 3 'Motor control
goto start 'Do again




Now, at least, you should be able to say what your mistake was.

Can you?


===================

mister_e
- 8th January 2008, 16:36
Hi Ajak,
Welcome on the forum.

When you post a question, please tell us everything, PIC used, Crystal speed (or internal one), which compiler and it's version, and post your schematic if you have any. This will also help us to give you a better answer to your question.

When you post your code, use the code tags, so your code format and indents will not be messed, easier for us to read it. What you need to do is to type



paste your code here



When asking a question, elaborate as much as possible. Your post don't show any official question... no problem description, no observation either.