go away spammer

Author Topic: Axon PWM and Processing  (Read 1551 times)

0 Members and 1 Guest are viewing this topic.

Offline mstachoTopic starter

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Axon PWM and Processing
« on: February 03, 2011, 01:33:40 PM »
Possibly a weird question, but let's say I change the PWM duty cycle to 50%, then carry on in a while loop or something to do something completely different.  I assume the PWM will still be working even though the control flow of the program is locked in the loop, is that right?  If so, does the PWM routine take up a lot of system resources?

I only ask because I'm eventually going to have to control 7 motors independently while doing some lower level processing and might need to squeeze every bit of speed out of the axon as possible :-P High level stuff will be done on a PC, though, but fast, reactive control is what I'm using the axon for!

Current project: tactile sensing systems for multifingered robot hands

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: Axon PWM and Processing
« Reply #1 on: February 03, 2011, 03:49:32 PM »
You assume correctly. Provided you configure hardware pwm using the timers and associated pins then there is no processing overhead at all, other then updating the value in a register when you want to change duty cycle. Microcontrollers are clever wee beasties!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Axon PWM and Processing
« Reply #2 on: February 03, 2011, 04:30:57 PM »
Depends on several factors.

If its hardware PWM, your software can do whatever you want and the PWM will still work perfectly no problem. The original Axon has 7 easy to use hardware PWM ports.

If its software PWM, it gets a little fickle as it requires interrupts for your other software to work. If you use WebbotLib, it'll handle everything for you in the best way possible (and easy enough for a beginner). You can use any pin on the Axon for software PWM, but hardware PWM (only certain pins) is always the better option if it's available.

You can also use both methods, if you have more than 7 motors. :P


Get Your Ad Here