16F1824 "HPWM 2" woes (command seemingly forces PortC.3 from analogue to digital)


Results 1 to 11 of 11

Threaded View

  1. #5
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: 16F1824 "HPWM 2" woes (command seemingly forces PortC.3 from analogue to digital)

    Well, for all my quick 'n dirty the workaround reverts my pin9 (PortC.1) ADC back to how it should be...

    Code:
    HPWM 2, duty, 32767
    TRISC.1 =1   'Remake PIN 9 PortC.1 an input again following HPWM command
    ....the actual HPWM command itself is still playing havoc with the signal....when I feed a steady sine wave into the ADC pin, it getting chopped up as viewed on a scope, as when the HPWM 2 command runs it interferes with PortC.1 - my now (naive) thinking is that it's forcing the pin to be an output, which then drags my sine wave analogue input signal down to zero, then my 'kludgey' follow on command makes the pin an input again...which restores the signal. But you can imagine the end result, it's as if a switch is being flicked rapidly thereby shunting the signal to ground .....fugly.

    i'm exhausted on this one & don't have an immediate good solution...I need to sleep on it (still a high possibility I'm just doing something wrong as my head is fuzzy now!). Tomorrow, I may sit down & work out how do do HPWM longhand using the PICs registers (one whole days lost on something as simple as this....eek!)
    Last edited by HankMcSpank; - 20th April 2011 at 23:31.

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