trying to use the HPWM command


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Rhatidbwoy,

    PBP assumes that the CCP1 port is on PORTC.2, but on the 648A it's on PORTB.3

    You can correct for this with ...
    DEFINE CCP1_REG PORTB
    DEFINE CCP1_BIT 3

    However, since you had already set PORTB to all output's, that will not solve the problem.

    You didn't mention what Oscillator freq you are using, but if it's more than 10mhz, you won't be able to get that low of frequency out of the CCP. For instance, at 20mhz, 1221hz is the minimum.
    <br>
    DT

  2. #2
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    I am using the internal osc. That is 4MHz. The funny thing to the whole is that I thought since I have to put 16f648a in MCStudio that would have changed this little delema that I have with the port, but I guess wrong.

    I will have to try that and see if it works. It should because I have seen this setup before.

    For the code below, what is the meaning to all of this. I do not get the PR2 = 49 making this 40k for the PWM period. What is the calculation and also this must be based to xtal size.

    'register setup (this is for a 16F684, so it may need to be modified slightly for your chip)

    PR2 = 49 'PWM Period 40K=49
    CCPR1L = 10 'PWM Duty Cycle
    T2CON = 4 'Timer2 = ON; Prescale = 1:1
    CCP1CON = 0 'PWM module off

Similar Threads

  1. My code for TV remote and MIBAM for RGB control
    By idtat in forum Code Examples
    Replies: 4
    Last Post: - 12th January 2013, 20:52
  2. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  3. HPWM command and oscillator frequency
    By RussMartin in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th March 2009, 22:41
  4. Can I do this???
    By noobie in forum mel PIC BASIC
    Replies: 2
    Last Post: - 10th June 2006, 18:57
  5. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43

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