go_away

Author Topic: Axon 1 keep resetting when using delay_cycles  (Read 1404 times)

0 Members and 1 Guest are viewing this topic.

Offline wanglalmTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Axon 1 keep resetting when using delay_cycles
« on: November 01, 2010, 11:28:40 PM »
Using the Axon Source Code v1.11.  int main(void)
   {
   //declare variables here
   int i=0;//useless variable
   int j=0;//useless variable

   //add 1.7s delay for potential power issues
   delay_cycles(65535);
it will not get pass the first delay_cycles
if i change the optimization to 1, it will exit any loop and start over from main.
If I load the test program the status led will keep blinking.
Please help.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,132
  • Helpful? 108
Re: Axon 1 keep resetting when using delay_cycles
« Reply #1 on: November 02, 2010, 05:43:50 AM »
Try using delay_ms(1700) instead.

Quote
if i change the optimization to 1, it will exit any loop and start over from main.

Note that is says this in the documentation:
Quote
Note that the compiler will ignore delay_cycles if you turn on compiler optimization.

This is because if you have code like this:
Code: [Select]
for(int i=0; i<10000;i++){
}
then the optimiser realises that there is nothing inside the loop, so you are asking it to do nothing 10000 times. So the optimiser says 'hey its actually doing anything' and removes the entire 'for' loop.


Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline wanglalmTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Axon 1 keep resetting when using delay_cycles
« Reply #2 on: November 02, 2010, 07:18:56 AM »
I have try using delay_ms(1700).  It is doing the same thing the mcu will reset itself.  The funny thing is that all the code is working fine until yesterday.
Quote
note that is says this in the documentation
Please tell where to find it.  all i found is something about VOLTAGE TOLERANCES.  thank you for you help.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots
Re: Axon 1 keep resetting when using delay_cycles
« Reply #3 on: November 02, 2010, 09:58:36 AM »
I have try using delay_ms(1700).  It is doing the same thing the mcu will reset itself.  The funny thing is that all the code is working fine until yesterday.
Quote
note that is says this in the documentation
Please tell where to find it.  all i found is something about VOLTAGE TOLERANCES.  thank you for you help.
Sounds like a battery problem. What is the battery voltage when plugged in?

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,132
  • Helpful? 108
Re: Axon 1 keep resetting when using delay_cycles
« Reply #4 on: November 02, 2010, 11:37:27 AM »
Quote
note that is says this in the documentation
Please tell where to find it.  all i found is something about VOLTAGE TOLERANCES.  thank you for you help.


See http://www.societyofrobots.com/axon/axon_function_list.shtml then the last paragraph of the 'DELAYS' section
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline wanglalmTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Axon 1 keep resetting when using delay_cycles
« Reply #5 on: November 02, 2010, 04:47:41 PM »
unregulated 7v  regulated 5v
I'm using 5 AA battery to power the whole thing.
If I do a omhn test on the unregulated I will get a high reading than it will fade away.
I think is my meter because it doesn't look like it is shorted or anything

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots
Re: Axon 1 keep resetting when using delay_cycles
« Reply #6 on: November 02, 2010, 04:59:26 PM »
unregulated 7v  regulated 5v
I'm using 5 AA battery to power the whole thing.
If I do a omhn test on the unregulated I will get a high reading than it will fade away.
I think is my meter because it doesn't look like it is shorted or anything
You measured exactly 7V from your batteries? These are lead acid batteries or?

If it's lead acid, 5 AA cells should be greater than 7.5V. At 7V, they are nearing the end of their little lives.

Offline wanglalmTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Axon 1 keep resetting when using delay_cycles
« Reply #7 on: November 02, 2010, 05:11:18 PM »
sorry I don't know if it is lead acid or not, it is the rechargable one from radio shack.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots
Re: Axon 1 keep resetting when using delay_cycles
« Reply #8 on: November 02, 2010, 05:26:35 PM »
sorry I don't know if it is lead acid or not, it is the rechargable one from radio shack.
What does it say on the package/battery?

Offline wanglalmTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Axon 1 keep resetting when using delay_cycles
« Reply #9 on: November 02, 2010, 05:33:34 PM »
it doen't say on the battery, I'm going to use a new battery tonight after work.  I have a fluke t5-600 meter, it will only show whole number, so there is no way for me to know unless i buy a new meter tomorrow. 

Offline wanglalmTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Axon 1 keep resetting when using delay_cycles
« Reply #10 on: November 02, 2010, 08:14:17 PM »
Just got home. I have replace all new battery, bought a new meter.  I have 7.8v on the unregulated and 5.2v on the regulated.
I'm pulling out my hair right now, what else can I do to fix this.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots
Re: Axon 1 keep resetting when using delay_cycles
« Reply #11 on: November 05, 2010, 05:06:15 PM »
Any luck?

Run the Axon sample code without modification and let us know if it works. If it does, then send us your code modifications so we can see what you're doing . . .

Offline wanglalmTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Axon 1 keep resetting when using delay_cycles
« Reply #12 on: November 07, 2010, 08:38:30 PM »
didn't know what just happen, but is working.  I didn't make any change to the code, or the hardware.  This is my first time building a robot, and believe me this is hard.  Starting from a $50 investment into about $500 and counting.  However, loving every minute of it.  Thank you admin for your website.
Today I got into another problem, the programmer is giving me this error
Setting mode and device parameters.. OK!
Entering programming mode.. FAILED!
Leaving programming mode.. OK!
I think is the fuses setting.  All the google search is telling me I need to restore the fuses with a parallel programmer.  I think I'm going to order a new axon or build a new board.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots
Re: Axon 1 keep resetting when using delay_cycles
« Reply #13 on: November 09, 2010, 11:31:59 AM »
I assume you are using an ISP programmer, right?

Go to the fuses tab, and see what fuses are selected. But *do not* change them unless you know what you are doing.

Offline wanglalmTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Axon 1 keep resetting when using delay_cycles
« Reply #14 on: November 09, 2010, 08:20:53 PM »
I have just order a new axon.  the problem is that I can't even go into the fuses. yes I'm using an isp.  I have an 2amp motor controller and I'm using 4 6v motor, each motor is No load current (6V): 160mA - Locked-rotor current (6V): 2.8A.  so I use 2 9v battery to bring it down to 2A for the motor controllers.  The power going to the controllers is around 18v and 5v for the control.  do you think that cause the axon to fire.  Please help because the axon is arriving tomorrow. Oh forget to tell you that the setup I have was working for a day or two, then it just fire on me.
« Last Edit: November 09, 2010, 08:23:13 PM by wanglalm »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots
Re: Axon 1 keep resetting when using delay_cycles
« Reply #15 on: November 10, 2010, 01:51:51 PM »
So, when you click the fuses tab you also get an error?

Are you sure you have it set for ATmega640? Did you ever push the Program button but didn't have power turned on accidentally?

Quote
The power going to the controllers is around 18v and 5v for the control.
Do you have 18V plugged into the Axon?

Offline wanglalmTopic starter

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Axon 1 keep resetting when using delay_cycles
« Reply #16 on: November 10, 2010, 08:21:14 PM »
Quote
Are you sure you have it set for ATmega640? Did you ever push the Program button but didn't have power turned on accidentally?
maybe, because I was working on the atmega8 and atmega16 at the same time.  I'll be very carefull next time.

18v is going to the motor control only.

 


Get Your Ad Here

data_list