|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
MAKE A MOTOR PULSE????
Hello, I would greatly appreciate if someone could help me figure out how to make a motor pulse using MPLab. For example, The motor (pwm03) needs to pulse on and off continually every second. Any help programming this would be greatly appreciated!!
|
|
#2
|
||||
|
||||
|
Re: MAKE A MOTOR PULSE????
why do you need it to?
use a timer and check it and then do mod math to find the time and turn on or off according to it |
|
#3
|
||||
|
||||
|
Re: MAKE A MOTOR PULSE????
The easy way to do this is:
You know that user_routines.c Default executes once every 26 (approx) ms. That means that every 38 loops is nearly exactly 1 second. Simply write a counter, and then an if-then-else. It would look something like this: count=count+1; if (count == 38) { pwmXX=255; count=0; } else pwmXX=127; Note you would want to declare the counter as a static variable. |
|
#4
|
||||
|
||||
|
Re: MAKE A MOTOR PULSE????
i need a little more help with this. Where exactly would i put the variables unsigned char unsigned int? Or does anyone have a simpler way of doing this? Please let me know i really need help. Thank You.
|
|
#5
|
||||
|
||||
|
Re: MAKE A MOTOR PULSE????
The only variable involved is your counter. Put it in the declaration section of the routine that you put the code in. This is generally located at the beginning of the routine before any of the code, but after the open bracket {
|
|
#6
|
||||
|
||||
|
Re: MAKE A MOTOR PULSE????
eh, unfortunately, i'm still kind of lost. Someone please help
![]() |
|
#7
|
||||
|
||||
|
Re: MAKE A MOTOR PULSE????
Ok, can you tell us how much experience you have with programming first of all.
-q |
|
#8
|
||||
|
||||
|
Re: MAKE A MOTOR PULSE????
well i can program the robot to move , program relays, sometimes digital inputs.... switches, triggers, buttons, autonomous.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Make my motor turn! | [RSMT]sturm | Programming | 6 | 24-01-2008 07:54 |
| make motor go slower | coolguybigt | Motors | 1 | 19-02-2007 09:36 |
| Remote Pulse Monitoring System | kaveena | Programming | 1 | 19-07-2006 10:02 |
| Measuring a Pulse Width | MikeDubreuil | Programming | 22 | 21-07-2005 10:22 |
| PUlse counting | junkyarddawg | Technical Discussion | 1 | 31-01-2002 15:33 |