problem using 16f877


Results 1 to 5 of 5

Threaded View

  1. #3
    yrch's Avatar
    yrch Guest


    Did you find this post helpful? Yes | No

    Post Another problem

    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.
    Last edited by yrch; - 21st January 2006 at 08:19.

Similar Threads

  1. 16f877 with LM335 problem
    By CrazyCooter in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 17th April 2015, 06:31
  2. 16F877 HSERIN problem with 3th party software
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 11th March 2009, 17:11
  3. LCD problem with 16F877
    By alexx_57 in forum General
    Replies: 10
    Last Post: - 25th July 2007, 13:47
  4. problem with 16f877 and display
    By Steve S. in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th January 2007, 21:53
  5. 16F877, DS18S20 and Serial Comm Problem
    By YellowTang in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th April 2004, 10:36

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts