Controlling Car With Motor Driver Board

Jason Kyngdon

New Member
OK PEOPLE!

I need to know if this is going to work. The program is pretty simple and it runs when an input is accepted via the comm port.

At the moment this program is doing **** all and I need some help. And by the way, I have covered the basics so don't ask me if the comm port is connected or the jumper switch is in the right position.

Thanks

'Picaxe buggy control system to control AXE023 Motor Driver Board (08) via comm port and
'Visual Basic.

'MOTOR A IS ON THE LEFT AND MOTOR B IS ON THE RIGHT WHEN LOOKING FROM THE BACK OF THE VEHICLE


main:

'turns motors on for one second to prepare the system

high 0
low 1
high 2
low 4
wait 1
low 0
low 1
low 2
low 4
wait 1

subSerial:

'turns both motors off and waits one second before accepting
'an input from the comm. port

low 0
low 1
low 2
low 4
wait 1
serin 3, N2400, b1
write b0,b1

subCmd:

'accepting input from the comm. port and the selection of what command to execute
'depending on what input is recieved

if b1 = 70 Then label_fwd
if b1 = 66 Then label_stop
if b1 = 76 Then label_left
if b1 = 82 Then label_right

label_F9: goto subSerial
end

'runs the buggy forward for 5 seconds then stops

label_fwd: high 0
low 1
high 2
low 4
wait 5
gosub label_shutdown
goto label_F9

'stops the buggy for 5 seconds then stops

label_stop: low 0
low 1
low 2
low 4
wait 5
goto label_F9

'turns the buggy left for 5 seconds then stops

label_left: low 1
high 0
high 2
low 4
wait 5
gosub label_shutdown
goto label_F9

'turns the buggy right for 5 seconds then stops

label_right: low 0
high 1
high 2
low 4
wait 5
gosub label_shutdown
goto label_F9

'because the buggy stops after each command is executed for a specific amount of time
'no stop command is nessecary. The buggy migh run into a wall and keep going but it will
'only go for that specific amount of time.

label_shutdown: low 0
low 1
low 2
low 4
return
 

MartinM57

Moderator
Well if it does nothing then you have to go back to basics to find out which bit isn't working...

So it's basic questions back to you, because that's probably all that can be asked at the moment

We can only help you if you help us to start with.

For example...

If you have a program that is self-contained (ie doesn't wait for commands from the PC), does that work on the board?

Have you tried just receiving from the PC and sending back what you get - use Bray's Terminal to do this rather than VB as it reduces the complexity

Is your VB actually sending the commands - how do you know? Use something like LGCommSpy++ to monitor the serial port on your PC
 

BeanieBots

Moderator
Why do you have the line:-
write b0,b1
just after the serin command.
You have not set a value for b0 so it will putting the received data into random memory locations. I could not see anywhere in you code where you read back the data you have saved to EEPROM.
If you not need to save the data to EEPROM then don't do it. EEPROM has limited write cycles and be worn out for no particular reason.

Does the motor actually run at power up for 1 second as dictated by your first section of code. If not, either the program did not load (and you will have seen an error message if that was the case) or you have a wiring fault or you are setting the wrong outputs.
If it does run for the 1 second period and then stops, things are getting held up at the serin command. If this is the case, you need to go back to basics and get your comms working first. Baud, polarity, etc. etc.

Just saying it does not work is of little use for us to help you. WHAT does not work? For all we know, it could be the fuse in your power supply!


Edited by - beaniebots on 05/07/2006 11:34:34
 

hippy

Ex-Staff (retired)
As BeanieBots indicates, there are numerous places where things could be going wrong, and the best way to progress is to work out what does and does not work. Write short programs to test all parts of the functionality separately. Once you know what does work ( and you've fixed what doesn't ), it should be easier to say what in particular doesn't work when all the bits are put together, and that helps to hone in on the problem.
 

Jason Kyngdon

New Member
Yeah, at the start up it turns them on for 1 second, but then it does nothing! I think it is still waiting for a command. I try to use the programming editor's terminal to no avail.
COULD SOMEONE OUT THERE MAKE THIS WORK PLEASE???????
Thankyou.
 
You can't use the programming editor's terminal window for that if you have the download cable connected, you need to connect the pin you do SERIN on to the rx serial pin. You may get away with just using a jumper wire on the picaxe prototyping board.

This is really something that I wish they'd fix in future picaxe proto boards.
 

Dippy

Moderator
What are your PC to PICAXE connections?
Is the serial from PC getting to the correct pin?
You sure? Have you got a 'scope?

Is this your first project?
 
Top