go_away

Author Topic: Axon source code v1.05 ( delay_ms() )  (Read 4263 times)

0 Members and 1 Guest are viewing this topic.

Offline HanoushTopic starter

  • Jr. Member
  • **
  • Posts: 42
  • Helpful? 0
Axon source code v1.05 ( delay_ms() )
« on: March 23, 2009, 04:43:28 AM »
it appears that delay_ms() doesn't work when I use v1.05 but it works when I use version v1.01 but Now I need to use PWM which is on v1.05.
any ideas ?
Code: [Select]
void Motor(void);
void control(void)
{

Motor();



//axon_DAQ();//activate the DAQ software (data acquisition)
}

void Motor(void)
{
rprintf("Initializing timer4 for PWM\r\n");
//PWM_Init_timer2_H6(10);
PWM_Init_timer4_H3(10);

rprintf("Turning on both PWM channels\r\n");
//PWM_timer2_On_H6();
PWM_timer4_On_H3();
delay_ms(1000);

rprintf("Setting PWM to 1%% duty cycle Warming Motor up\r\n");
//PWM_timer2_Set_H6(0);
PWM_timer4_Set_H3(0);
delay_ms(6000);

rprintf("Setting PWM to 100%% duty cycle Warming Motor up\r\n");
//PWM_timer2_Set_H6(255);
PWM_timer4_Set_H3(1023);
delay_ms(6000);



rprintf("Setting PWM to 1%% duty cycle\r\n");
//PWM_timer2_Set_H6(1);
PWM_timer4_Set_H3(1);
delay_ms(5000);

rprintf("Setting PWM to 12.5%% duty cycle\r\n");
//PWM_timer2_Set_H6(127);
PWM_timer4_Set_H3(127);
delay_ms(5000);

rprintf("Setting PWM to 25%% duty cycle\r\n");
//PWM_timer2_Set_H6(254);
PWM_timer4_Set_H3(254);
delay_ms(5000);

rprintf("Setting PWM to 50%% duty cycle\r\n");
//PWM_timer2_Set_H6(254);
PWM_timer4_Set_H3(512);
delay_ms(5000);


rprintf("Setting PWM to 99%% duty cycle\r\n");
//PWM_timer2_Set_H6(254);
PWM_timer4_Set_H3(1023);
delay_ms(5000);

rprintf("Turning off PWM\r\n");
//PWM_timer2_Off_H6();
PWM_timer4_Off_H3();
delay_ms(1000);

}

Offline Tomas

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 0
Re: Axon source code v1.05 ( delay_ms() )
« Reply #1 on: March 23, 2009, 08:44:36 AM »
What doesnt work? What happens?

 ???

Offline HanoushTopic starter

  • Jr. Member
  • **
  • Posts: 42
  • Helpful? 0
Re: Axon source code v1.05 ( delay_ms() )
« Reply #2 on: March 23, 2009, 04:41:31 PM »
it just stops running when it have to excute delay_ms().
and when I replaced delay_ms() with a for loop
Code: [Select]
for(i=0;i<1000;i++)
{
delay_cycles(1000);
}
it works fine for a while but for a sudden the Axon starts to print "warming up" a lot on the hyperterminal.
Please help because I am building a Quadcopter and I can't have unstable system on it.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Axon source code v1.05 ( delay_ms() )
« Reply #3 on: March 24, 2009, 01:01:47 PM »
i dont think axon will be a suitable processor for a quadcopter....u need a processor with atleast 50mhz speed to make any kinda UAV to hndle flight and all the gps data and all...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline HanoushTopic starter

  • Jr. Member
  • **
  • Posts: 42
  • Helpful? 0
Re: Axon source code v1.05 ( delay_ms() )
« Reply #4 on: March 24, 2009, 04:11:15 PM »
Well,I am thinking to use copilot that will help me to make the quadcopter stable when it isn't recieving any signal and that will save me alot of processing time if I will use gyroscopes and kalman filter or fuzzy logic control for it.
so,Axon will only control the motors,read ultrasonic sensors and take coordinates from the GPS.
Do you think that will work ?

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: Axon source code v1.05 ( delay_ms() )
« Reply #5 on: March 24, 2009, 04:13:10 PM »
Very possible, see here:
http://www.mikrokopter.de/ucwiki/en/MikroKopter

They are using a 644 at 20mhz.

Offline HanoushTopic starter

  • Jr. Member
  • **
  • Posts: 42
  • Helpful? 0
Re: Axon source code v1.05 ( delay_ms() )
« Reply #6 on: March 24, 2009, 05:39:17 PM »
I am thinking to try out the Arduino Duemilanove and see if it is more stable than the Axon.It is based on ATMEGA 328 20MHZ. I already got one but never used it. anyone used it before ?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,663
  • Helpful? 169
    • Society of Robots
Re: Axon source code v1.05 ( delay_ms() )
« Reply #7 on: March 24, 2009, 11:18:07 PM »
delay_ms() with all Axon code versions works perfectly fine for me . . . there is something else you aren't doing right . . .

Offline HanoushTopic starter

  • Jr. Member
  • **
  • Posts: 42
  • Helpful? 0
Re: Axon source code v1.05 ( delay_ms() )
« Reply #8 on: March 25, 2009, 02:19:02 AM »
I thought I do ,but Axon works perfectly when I use v1.01 but I want to use PWM with higher resolution and when I used the PWM code that you posted on the website, it ddin't work altough it worked once on my old Axon but I was using brushed motors but it is the same I think. Please tell me what could have gone wrong ?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,663
  • Helpful? 169
    • Society of Robots
Re: Axon source code v1.05 ( delay_ms() )
« Reply #9 on: March 25, 2009, 02:36:59 AM »
Did you overwrite *all* files with the v1.05 version, including the make file?

When you say it didn't work, you mean you ran this code:
delay_ms(10000);
And it didn't actually delay?

Did you turn optimization on? (it only works when it is turned off)

Offline HanoushTopic starter

  • Jr. Member
  • **
  • Posts: 42
  • Helpful? 0
Re: Axon source code v1.05 ( delay_ms() )
« Reply #10 on: March 25, 2009, 04:50:56 AM »
Yes when I use it,Axon freezes or start to reset and print "Warming up".
Where do you turn optimization on and off ? I don't remember changing anything.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,663
  • Helpful? 169
    • Society of Robots
Re: Axon source code v1.05 ( delay_ms() )
« Reply #11 on: March 25, 2009, 10:07:48 AM »
Run a much simpler program that doesn't involve motor(). And just rprintf before and after a delay. See what the output is.

rprintf()
delay_ms()
rprintf()

Also, are you sure your battery is fully charged?

Offline HanoushTopic starter

  • Jr. Member
  • **
  • Posts: 42
  • Helpful? 0
Re: Axon source code v1.05 ( delay_ms() )
« Reply #12 on: March 25, 2009, 12:40:37 PM »
I tried but didn't work also on v1.05 :@ and I was using a power supply. A friend of mine have an Axon,I will try to use his axon on my code and see what will happen.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,663
  • Helpful? 169
    • Society of Robots
Re: Axon source code v1.05 ( delay_ms() )
« Reply #13 on: March 25, 2009, 08:56:00 PM »
Quote
and I was using a power supply.
What is this power supply rated at? Is it also powering your motors?

Offline HanoushTopic starter

  • Jr. Member
  • **
  • Posts: 42
  • Helpful? 0
Re: Axon source code v1.05 ( delay_ms() )
« Reply #14 on: March 26, 2009, 12:32:06 AM »
7.2V and let the Axon take its current and it work perfectly when I use v1.01 and for the motors I use 9.6V 1600mah battery.
and sometimes I switch and use the power supply for the motors because it worls better when i increase the current and The 9.6V battery for the Axon.

Offline Luke

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: Axon source code v1.05 ( delay_ms() )
« Reply #15 on: June 26, 2009, 02:39:36 PM »
I know this thread is kinda old, but I thought I'd post after something similar happened to me. I don't know why version 1.01 works and 1.05 doesn't, but it looks like you are missing initializing the timer for delay_ms().

If you add a "timer0Init();" function call to the start of you app, the delay_ms should work.



« Last Edit: June 26, 2009, 02:41:01 PM by Luke »

Offline PhilG

  • Beginner
  • *
  • Posts: 1
  • Helpful? 0
Re: Axon source code v1.05 ( delay_ms() )
« Reply #16 on: August 21, 2009, 07:04:28 PM »
thanks luke! I was having this problem also and didn't know I had to initialize timers!

 


Get Your Ad Here