Hello again!
Thanks for your quick response to my post. I guess you were right about the datasheet issue, by examining a bit more and doing a little more research helped me solve my problem.
However, now I have a problem which I happen to find several solutions, but cannot comprehend them due to my limited knowledge and therefore ask for your help here urgently. This time I have looked at the datasheet carefully, but like I said, it wasn't much of an help since I have trouble understanding it.
What I'm trying to do at the moment is simply driving a DC motor with a L293D driver circuit and the same PIC, 16F877. According to my program, it needs to run in one direction for 3 seconds, then stop for 1 second and then run in the opposite direction for 3 seconds again. I don' t really need speed control, that is optional, but I do need the reverse direction, which is why I'm using the L293D as a H-bridge.
Now I will move onto things I have learned through my research on the internet, so that you can help me out better:
From what I have read, it seems that I need to use (or I better use?) either C1 or C2 port (or both?) for connection to the enable pins on the H-bridge and I should use the PWM module even if I'm going to control the speed of the motor.
To use the PWM correctly, several data registers should be modified, such as CCP1CON, T2CON and the pulse frequency PR2 and the duty cycle CCPR1L.
I'm going to be using a DC motor with a 12V input. Though I don't have much of an idea about how those registers should be modified, I added the following lines in my program according to what I have read on the internet:
CCP1CON = 12
CCP2CON = 12
T2CON = %00000101
PR2 = 249
CCPR1L = 124
CCPR2L = 124
I think the duty cycle and the pulse frequency should be modified in such a way that the desired working and pause periods (3 secs & 1 sec) are achieved. Or are these values unable to determine the motor's sequence and delay and should it be specified within the actual running code (like with "Pause 3000")? If not, how are these aspects related? Apart from the C1 and C2 ports connecting to the enable pins of L293D, I think two additional output ports are required to give the proper rotation direction of the motor. Can these be any port on the 16F877? I have also read that the enable pins should be high, while the directions pins are set low and high one by one. Is there anything else I should know about the enable pins? (because last time I ran the program, no matter which stage of the program it is in, it was always high.
This is the summary of what I have understood sand what I have not so far. Thank you in advance for your patience and help.
Bookmarks