sending a 120khz pwm with 50% duty cycle at several time(delay)


Closed Thread
Results 1 to 10 of 10

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    With the code above you'll only get a 1/2 ms delay...
    Not necessarily true.
    If compiled with PM.exe which is NOT case sensitive. It'll do just fine at 8mhz.

    texas5,
    Much closer, but there's still one issue.
    That will work good for the first burst. But since timer2 is still running, the next time you try to send a burst, timer2 may have already past the PR2 value when you start the PWM. Then it will have to wait for it to roll over at 256 counts before it starts up the PWM again.

    That would cause the loss of up to 17 of the anticipated 125 cycles you would get during the 1ms period.

    After stopping the PWM you should also STOP and RESET Timer2 to 0 ...
    <br>
    DT

  2. #2
    Join Date
    Aug 2008
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    thanx skimask...thanx Darrel Taylor...your explanation seem clear to me.so i just need to set the 'T2CON.2 = 0' after stopping the pwm and set it to 'T2CON.2 = 1' back if i want to burst it one more time.

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


    Did you find this post helpful? Yes | No

    Default

    Yes, but also set ...

    TMR2 = 0
    <br>
    DT

  4. #4
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    That would cause the loss of up to 17 of the anticipated 125 cycles you would get during the 1ms period.
    Which is not a deal-breaker as X-10 receivers only look for 48 cycles during a window that extends from ZC+250uS to ZC+900uS. Still, one should follow X-10's recommendations to start the 120kHz burst within ZC+100uS. You're already losing some of that window as the PIC is late detecting ZC on rising edges (assuming the ZC detector given in AN236).

Similar Threads

  1. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  2. PWM PIN(S), DUTY, CYCLE ?Plural possible?
    By earltyso in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th November 2007, 20:41
  3. HPWM the old fashioned way
    By Srigopal007 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 19th November 2004, 19:09
  4. PWM _ Duty Cycle in Tenths
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 17th May 2004, 12:09
  5. Duty Cycle Dilemmas
    By crankshaft in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 27th February 2003, 12:40

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