View Single Post
  #6   Spotlight this post!  
Unread 02-02-2004, 11:51
Zee Zee is offline
Registered User
no team
 
Join Date: Jan 2004
Location: USA
Posts: 8
Zee is an unknown quantity at this point
Re: Encoder Counts/time period to PWM value

Quote:
Originally Posted by Kevin Watson
You can only do this if the motor is unloaded (and even then it's shakey, at best). In general you can't directly correlate a PWM value to a rotational rate. As noted elsewhere, you are better off commanding a velocity and letting a control loop set the PWM value. There are likely to be motor control examples in the white paper and programming areas.

-Kevin
This is why I ask. My PID closed loop control is based on SilverStar's algorithm. He isn't accepting private messages or I'd ask him directly. I have a function:

int PID(int request, int actual, int *lastActual, signed int *sum)

In my code, request and actual will be PWM values from 0-255. The request PWM value will come from input from the joystick. The actual PWM value will come from the encoder. My question is, the encoder produces counts/time period. How do you get an actual PWM value from this. Or am I going about it all wrong?