Society of Robots - Robot Forum
Software => Software => Topic started by: taba93 on December 13, 2009, 07:14:15 AM
-
Hi all,
I would like only to know if this method could teorically work.
I have the Axon and the Sabertooth 2x10 motor controller.
I have connected the Uart2 Tx Pin to the S1 port of the Sabertooth and the G Pin to the 0V port of the Sabertooth. I have set the switches of the Axon with the same method of page 13 of the Sabertooth datasheet -> http://www.dimensionengineering.com/datasheets/Sabertooth2x10.pdf (http://www.dimensionengineering.com/datasheets/Sabertooth2x10.pdf) (the 38400 baud rate) and I've written this simple code:
Eurex_rr.c file:
//SoR Include
#include "SoR_Utils.h" //includes all the technical stuff
#include "hardware.c" //declare hardware variables and ports
//#include "CMUcam.c" //not yet written
#include "sensors.c" //sensor libraries for sonar, sharp IR, etc.
#include "misc.c" //includes libraries for various hardware and other useful stuff
#include "axon_DAQ.c" //use the Axon like a data acquisition device
//#include "Blackfin_Axon.c" //files for Blackfin Robot camera
#include "control.c" //your code goes in here
//#include "servo_controller.c" //Axon servo controller
//#include "axon_test.c" //include this is doing a function test for the Axon
//#include "axon_oscope_test.c" //include this is doing a function test for the Axon
int main(void)
{
while (1 == 1){
sabertooth (40,179);
}
}
and I compile it in a hex file and I must now only upload it to the Axon microcontroller. Is this going to work?
Thank you, bye bye
-
I have set the switches of the Axon with the same method of page 13 of the Sabertooth datasheet
Axon doesn't have switches :P
(I know what you meant, just making fun thats all :P)
while (1 == 1)
should be:
while(1)
Otherwise on quick glance it all looks fine.
-
Yeah I know! ;D I'll try and I will tell you later!
-
I tried it today. First I've uploaded to the Axon the axon_tst.hex file to try the UART ports and it all looks fine cause the motor began to move (this means that the connections are fine).
After that, I compiled my "Eurex_rr.c" file doing "Build" in Avr Studio and I've upload it to the axon. The result was that the motors didn't move. First I thought that I've done some errors in my file or in the "misc.c" file but there were no errors. So I tried to put in my code this line: "LED_on();" only to know if it works but the led didn't turn on and I don't know why.
Are there some errors? ??? bye
-
taba93
I could not help but notice that you have an INCLUDE line:
#include "control.c" //your code goes in here
I could be wrong but is not "control.c" the default example source file. You have created your own file "Eurex_rr.c" which replaces "control.c". Therefore to have it as in INCLUDE may be causing some confusion.
Hope this helps
Invicta
-
Hi invicta,
I tried this but it doesn't work. What I'm doing wrong?
@Admin only to know is it possible to have the source of the axon_tst.hex file (I mean the c file?) cause if I upload this file it works!
Thank you
-
I forgot to say a thing. In my opinion the problem is the code (but it is strange cause you say me that should work) or the compilation but that seem to work too!
-
Put various rprintf("testA");'s in various places. This will tell you where your code stopped working.
Also, add a 50ms delay after
sabertooth (40,179);
-
Ok , I'll try, but it is really strange, cause if I do only an easy thing like:
while(1){
LED_on();
}
it doesn't work!
-
Does the demo code that comes with the Axon work fine?
When you check it with a multimeter, everything works fine? Are you sure you are uploading the correct .hex file?
-
Which demo code? I only upload the various precompiled programs from this site to the axon and they work. When I go in hyperterminal for example I receive the rprintf results of the axon_tst.hex file.
When I check it with a multimeter it doesn't work at all if I upload my compiled file. If I upload instead one of your compiled programs it works perfectly.
-
Start with the demo photovore code, then selectively modify it to match what you want.
I just noticed you aren't initializing the UART, you aren't initializing timers, nor are you configuring ports. :P
When I check it with a multimeter it doesn't work at all if I upload my compiled file.
What do you mean? Is the voltage 5V and the battery something higher?
-
1. ok I'll try. I must initialize ports using the function configuration_ports(); or something like that? (I don't remember the name precisly :P)
2. nono, the UART port (for example) is 0V...instead with your precompiled program the voltage is 5V!
thank you a lot!
-
Ok, now it works! thanks for the help. Happy holidays!