![]() |
![]() |
![]() |
|
|
|||||||
| Robotics Chat Specific to discussions about robots and the making of. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) | |
|
Quote:
But anyway, does the motor turn at all? May be not , because you should use RC2 to control the motor instead of RC5. Check the data sheet, pin 17 is RC2/ CCP1.
__________________
May the force be with you. My project: Simple White Line Follower http://au.youtube.com/watch?v=8Z_MmrdH4oc http://i271.photobucket.com/albums/j...nefollower.jpg |
||
|
|
|
|
|
(permalink) |
|
Oh, just one more thing, is the motor controller chip or transistors circuit OK?
__________________
May the force be with you. My project: Simple White Line Follower http://au.youtube.com/watch?v=8Z_MmrdH4oc http://i271.photobucket.com/albums/j...nefollower.jpg |
|
|
|
|
|
|
(permalink) |
|
i m using a motor driver to control the direction and speed of motor turning. form the motor driver connected with motor and got 3 pin is connect to ic. 1 pin is RC1 and another 2 is the direction of turning which can set at RC4 or RC5. exp RC4 turn clockwise, RC5 turn anticlock wise!!then the code is ok?
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
You should use RC2 for PWM to control the speed, because RC2 is the dedicated pin for CCP1. Check data sheet.
__________________
May the force be with you. My project: Simple White Line Follower http://au.youtube.com/watch?v=8Z_MmrdH4oc http://i271.photobucket.com/albums/j...nefollower.jpg |
||
|
|
|
|
|
(permalink) | |
|
Quote:
yaya i use RC2 wrong type last time!!! but the motor still not turning! Y? i use PIC simulate to test and see the RC2 some time on sometime off!! how come.... it should keep 'on' to turn the motor!! |
||
|
|
|
|
|
(permalink) | |
|
Quote:
I think your seting is 2 Khz, 50% duty cycle pulses? If you can confirm (with oscilloscope may be) there are pulses with 500uS period ( 2 Khz), 250uS on and 250uS off (50 % duty cycle) on RC2. then you know your program is working. May be your setup on the motor driver is incorrect? May be the motor draws too much current? You have to isolate which part is not working. Hope this helps.
__________________
May the force be with you. My project: Simple White Line Follower http://au.youtube.com/watch?v=8Z_MmrdH4oc http://i271.photobucket.com/albums/j...nefollower.jpg |
||
|
|
|
|
|
(permalink) |
|
ya i using a software call PIC simulator that can see the output and set the input to the PIC!!ya i get the RC2 on and off so it is correct!! but when i test to the motor driver and the motor, the motor not turning!! i think is my board problem!!
|
|
|
|
|
|
|
(permalink) |
|
because you already set the output of RC2 to PWM mode at the beginning, so you will see it sometime is on and sometime is off. i think is your main broad got problem, design problem. you should fully understand how your motor driver circuit function and which pin you are chosing. Direct copy without understand is not a process of study.
since you are using the 20Mhz crystal, so in calculation the time will different. the duty cycle and the period is most important part in PWM. If setting is wrong, your motor ofcause cannot function and control speed. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
Wingmax i success control the speed and the direction alr!!! THZ alot!!! from the code below i cjust change the CCPR2L to max or min then can change the speed ler!!! but i still not understand wat the pulse for!! exp 4K pulse and 2K pulse!!! hope to hear from u!! thz!!
here is the code!! #include <pic.h> __CONFIG(WDTDIS & XT & UNPROTECT & BORDIS & LVPDIS); #define XTAL 20000000 //crystal frequency- 20MHz void setup () { TRISB = 0xFF; TRISC = 0x00; PORTC = 0x00; CCPR2L = 0x00; CCP2CON = 0b00011100; T2CON = 0b01111111; PR2 = 0x9C; } void main () { setup (); if (RB7==1) { PORTC = 0b00010000; CCPR2L = 0xff; } else { PORTC = 0b00100000; CCPR2L = 0xff; } } |
|
|
|
|
|
|
(permalink) | |
|
Quote:
CCPR2L is to set the duty cycle of the pulse, ie the pulse width. That's what's adjusting the speed. So what you did is adjusting the speed of min to max. We normally choose a suitable frequency of the pulses for the motor so that it's not making annoying noise, or causing erratic function of the motor. We keep this frequency constant and adjust the motor speed by varying the pulse width of the pulses.
__________________
May the force be with you. My project: Simple White Line Follower http://au.youtube.com/watch?v=8Z_MmrdH4oc http://i271.photobucket.com/albums/j...nefollower.jpg |
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Motor Overheating w/ Speed | dknguyen | Robotics Chat | 10 | 16th October 2007 04:53 PM |
| DC motor Control, Timer | mitchell.s | General Electronics Chat | 3 | 6th October 2007 08:18 PM |
| Variable DC motor speed control | fabbie | Electronic Projects Design/Ideas/Reviews | 6 | 17th October 2004 05:13 AM |
| Looking for AC motor speed control circuit | Tako Kichi | Electronic Projects Design/Ideas/Reviews | 3 | 4th August 2004 06:16 AM |
| To control speed of motor by distance of 2 objects | ahkumm | Electronic Projects Design/Ideas/Reviews | 1 | 28th October 2002 10:07 AM |