Quick n dirty HPWM out of phase


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Re: Quick n dirty HPWM out of phase

    The following is how I do it. works well and is super easy. I see this is an old post, but hey, it might help someone!
    Use the tilda ~ before the variable! I use this on a 16F873A and a 16F1503 and the 1824, works great.


    '*********** Define ADCIN parameters *************************************

    DEFINE OSC 4
    DEFINE ADC_BITS 8 ' Set number of bits in result
    DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
    DEFINE ADC_SAMPLEUS 15 ' Set sampling time in uS

    XADCVAR VAR WORD ' X ADC Result
    PWMOUT1 var byte ' PWM CH1
    PWMOUT2 VAR BYTE ' PWM CH2

    '*********** SET PORTS ************************************************

    TRISA = %000001 ' Set PORTA
    TRISB = %00000000 ' Set PORTB
    TRISC = %00000000 ' Set PORTC
    ADCON0 = 0 ' Set up ADCON1

    BEGIN:

    '*********** CHECK ADC VALUE ******************************************

    MAIN:
    ADCIN 0, XadcVar ' convert ADC value to a byte value:
    PWMOUT1 = XadcVar ' X Axis
    PWMOUT2 = ~XadcVar ' Y Axis

    Hpwm 1,PWMOUT1,1600
    Hpwm 2,PWMOUT2,1600
    Goto BEGIN

    end
    Last edited by scasale; - 17th August 2014 at 06:31.

Similar Threads

  1. 3 phase supply detector challenge
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 15th May 2009, 08:54
  2. VFD and HPWM
    By shawn in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th January 2009, 03:12
  3. HPWM of the port of two HPWM
    By ja2rqk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2007, 16:05
  4. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 15:14
  5. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 03: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