BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 7:59 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: HPWM ODD BEHAVIOR
PostPosted: Wed Jan 25, 2012 5:45 pm 
Offline
Citizen

Joined: Thu Jun 23, 2011 6:29 pm
Posts: 17
Sorry: this was meant to go into the Atom board, not atomPro.
Hello: I am trying to use HPWM and seeing an odd behavior. If I manually set the duty to my maximum period of 12800 then my motor runs fine, if I have code that changes it however then the motor stops running when it gets close to the maximum duty cycle. I am using a lynxmotion PS2 controller and trying to get variable speed from the joystick. I have a fixed motor period of 12,800 set in code
The following code works fine.
-----------------
FORWARDFULL
HIGH P9
HIGH P10
HIGH P11
HIGH P8
HPWM LEFTWHEEL,LEFTMOTORPERIOD,12800
serout 1,i9600,[1,1,dec leftmotorduty]
RETURN
yet the next code segment stops the motor when it gets close to the 12,800 value. It seems to stop around 11,400 but is random so I cannot say an exact figure. I can watch the serial output, I so know the value is not ever going over 12,800 in fact I also used some code to set it at a maximum of 12,800 after the joystick values are added and it still quits the motor. The motor is nicely variable up to around the 11,400 value. Wyy don't I just set it to stop at 11,400? because I tried that, and now it stops running at around 10,000 !
I cant understand this. Also it would be nice to know I am getting full motor speeds.

FORWARD: ' Goes forward
HIGH P9
HIGH P10
HIGH P11
HIGH P8
left_joy_y = 128 - left_joy_y
leftmotorduty = (left_joy_y * 100)
HPWM LEFTWHEEL,LEFTMOTORPERIOD,LEFTMOTORDUTY
serout 1,i9600,[1,1,dec leftmotorduty]
'HPWM RIGHTWHEEL,RIGHTMOTORPERIOD,RIGHTMOTORDUTY
return

FInally I tried the wait command tp prevent any glitches and it throws a compiler error.
HPWM LEFTWHEEL,LEFTMOTORPERIOD,LEFTMOTORDUTY, 1
I am on the latest 2.0.0.15 compiler.
1 last question. what is a good value to be using for motor period, I dont want to much noise getting back into my electronics.
Thank you for any advice.
-Stampee


Top
 Profile  
 
 Post subject: Re: HPWM ODD BEHAVIOR
PostPosted: Sat Jan 28, 2012 7:13 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
The wait option only applies to AtomPro chips. The Atom chips HPWM hardware already is glitch free. The PICmicros CCP only updates the PWM period and duty at the end of the current period cycle so you don't get glitches.

In order to get the full range of the PWM hardware on the PICmicro we use all of the timer multipliers. The HPWM command is calculating the timer multiplier to use and then correcting the period/duty being set. Its possible you are hitting a special case that isn't being handled properly.

Can you email me with the below code along with the description of the problem so I can take a look at it when I'm at work?

nathan@basicmicro.com

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO