capturing signal and outputing it


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    just managed to get it to work with 3phases and to average them and output them... but im still unsure on the actual values. when a period is measured what does it get measured in? and how do i relate that to pwm?

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Cool

    Hi,

    A closer look at your PIC Datasheet will show you HOW the CCP modules work ...

    and from that ... What's the counting unit ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Well the timer measuring the period is being clocked by something, it apperars you're using the main oscillator as the source for that. Then there's a prescaler that can divide the main clock but it appears you have that set to 1:1. So if the PIC runs at 20MHz one timer "tick" is 200nS.

    If the timer value is captured (and then reset) on the rising edge and you get a timer value of 1234 then the persiod is 1234*200nS = 246.8uS.

    /Henrik.

  4. #4
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    hey thanks!

    i had just worked that all out before i got the reply! but its just confirmed my calculations which is good. 0.2us is one timer tick so i know how to scale it all now.

    i am having another problem if anyone can shed some light on it? im getting the right pulsewidth and the right frequency output (inrespect to my input) however its glitching every now and then and isnt giving me a perfectly smooth pwm output.

    its glitching is not coinciding with tiny fluctuations in the input signal either...

    could it be due to over measuring?

    thanks!

  5. #5
    Join Date
    Oct 2004
    Location
    North Norfolk UK
    Posts
    146


    Did you find this post helpful? Yes | No

    Default

    Have you considered using the HWPM facilty?

    Duncan


    ......

  6. #6
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    duncan303 Have you considered using the HWPM facilty?

    Duncan


    ......
    i tried implementing the hpwm facility but it didnt seem to work for me very well... i cant remember what the problem was now but there was a reason i didnt use it. my pwm code i know works fine... ive got it working beautifully smooth from another pic... but when i add the code to capture and then output a signal that has nothing to do with the input signal it has random flickerings on the output...

  7. #7
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    update:

    i have got it working pretty nicely now, although i have added a 5 second pause to slow down updates.

    there is very rarely a flickering now, which leads me to believe the highly frequent flickering before was caused by capturing and updating to quickly... why would this be tho?

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