How to generate three phase pwm?

Discussion in 'Embedded Systems and Microcontrollers' started by mehmeter3, Aug 31, 2014.

  1. mehmeter3

    Thread Starter New Member

    Dec 19, 2013
    13
    0
    Hello,

    I'm a newbie in these things and wondering how we can generate three phase (ab 25 kHz, 0 -5V) PWM in CCS C with PIC16/18. Thanx.

    I know the single phase only below:

    #include <16F72.h>
    #use delay(clock=4000000)
    #fuses NOWDT,XT, NOPROTECT
    int value;

    main()
    {
    setup_adc_ports( ALL_ANALOG );
    setup_adc(ADC_CLOCK_INTERNAL );
    setup_timer_2 ( T2_DIV_BY_4, value, 2);
    set_adc_channel( 0 );
    setup_ccp1(CCP_pwm);
    while(true)
    {
    delay_ms(100);
    value = read_adc();
    setup_timer_2 ( T2_DIV_BY_16, value, 2);
    }
    }
     
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,386
    496
    I don't think that code is for generating pwm.
    I guess this is good attempt at fishing for answers using bogus code.
     
  3. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,515
    2,369
    There are a few Picmicro app notes on 3 phase, AN900 for one.
    Max.
     
  4. mehmeter3

    Thread Starter New Member

    Dec 19, 2013
    13
    0
    Why dont u test the above code b4 u make sluggish comment?
     
  5. matthew798

    Member

    Jan 16, 2013
    38
    2
    shteii01 is right. That code looks like an analog read.

    You should look into the pwm units in most pics. You can generate very precise PWM signals.

    They are called ECCP (enhanced capture / compare / PWM) modules. Very easy to use.
     
Loading...