Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Globe Motor Programming Questions (http://www.chiefdelphi.com/forums/showthread.php?t=48292)

Qbranch 08-08-2006 14:56

Re: Globe Motor Programming Questions
 
Quote:

Originally Posted by Mark McLeod
You're correct that if pwm01 gets set to a number greater than 255 it will wrap around to zero and you'll suddenly go from full forward to full reverse.

In the TxData struct, all PWM values are defined as type 'unsigned char' - or one byte. Assigning a value greater than 255 will cause unpredictable processor operation unless you are VERY lucky.

Most programmers are used to C/C++/C#/C.NET which traps all your errors.... such as overflow. In the processor, it does exactly what you tell it to do. All defining some thing as a uchar does is tell the linker to offset the next thing in memory by 1 byte. Sooooo if you write a number bigger than a byte, you will interfere with the next bit down the line in processor memory. This would in effect change the value of the next variable.

-Q

Qbranch 08-08-2006 15:03

Re: Globe Motor Programming Questions
 
Quote:

Originally Posted by Matt H.
To respond to the original question; the type of motor is not incredibly important as long as it runs on a PWM signal. What you need to do is set your PWMs as shown in the first response and assuming you are using the FRC robot controller and default MP labs code it will convert that data into a usable signal for any standard PWM motor.


Matt something you may want to try sometime to understand better the premise on which PWM motor control works is examining the output of a Victor or other H-Bridge Drive's output.

If you have access to an oscilloscope, hook the probe end to M+ and the alligator clip to M-, and set your oscilloscope to trigger on a rising edge. Then use a joystick to vary the 'power level' (duty cycle percentage) to the motor. As the speed of the motor changes, watch what the ratio of up and down time on the pulse train does.

If you have any questions i'll be happy to answer them.

-Q


All times are GMT -5. The time now is 23:00.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi