Author Topic: Verilog  (Read 1632 times)

0 Members and 1 Guest are viewing this topic.

Offline aerowennTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
Verilog
« on: December 03, 2010, 12:21:03 AM »
I'm using an FPGA for my bot, partially to contribute to my Verilog knowledge (I'm already fairly experienced in it). Controlling a servo to a very fine resolution is no problem at all, but, recently I've been hammering out code that will move the servo at different speeds by slowly changing the pulse width versus instantaneously. Anyone out there done this before have a few pointers? The test I ran today had a lot of jittery movement once it reach the stop angle, I sure the cause is where I used my count increment value as the speed control, so it went something like this:

if(count == StopPulse) count = count; 
if(count<StopPulse) count = count + spdinc;
if(count>StopPulse) count = count - spdinc;

This isn't the exact code, but you get the idea. So if spdinc was say... 3, it could pass up StopPulse, then try and find it again, pass it up, and so on.

I am considering the possibility of using an active clock divider instead of a set one, so changing the clock speed essentially that controls the count vs count increment changes. I'm having trouble getting it to like this.

In all honesty, I probably shouldn't worry about speed right now, but it would be nice to have it as an option on my base PWM driving modules.

 


Get Your Ad Here

data_list