This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

pwm

I am new to XC164 and to PWM. I am trying to control some DC motors.
Does anybody has any software examples on how to implement PWMs on CAPCOM1/2 and CAPCOM6 on XC164 micro?
Also, does anybody know how many simple and independent PWMs can be implemented using XC164 micro?

Thank you,
Oliver

Parents
  • /* This defines the timer reload value.  The actual value is based on the
       selected resolution.  The maximum valve coil value is also set up here.
       Passing a value greater than MAX_COIL_VAL to the valve coil driver output
       functions will generate a runtime error.*/
    #define COIL_RELOAD  0x0FC00     /* 2.441 KHz output frequency*/
    #define MAX_COIL_VAL 0x003FE
    #define OFFSET_VAL   48
    
    /* The PWM outputs are controlled by CAPCOM channels 0 through 7. This word is
       programmed into registers CCM0 and CCM1 so that these channels operate in
       compare mode 3 and are allocated to timers T0 and T7.*/
    #define CCMX_INIT_PWM_OUTPUTS    0x07777;
    
    
    /* The DC outputs are controlled by CAPCOM channels 16 through 23. This word is
       programmed into registers CCM4 and CCM5 so that these channels operate in
       compare mode 2 and are allocated to timers T0 and T7.  In compare mode 2, the
       output pin is unaffected by an interrupt and therefor the output can be used
       as a dc output.*/
    #define CCMX_INIT_DC_OUTPUTS   0x06666;
    #define INIT_DC_OUPUT          0x06;
    
    
    

Reply
  • /* This defines the timer reload value.  The actual value is based on the
       selected resolution.  The maximum valve coil value is also set up here.
       Passing a value greater than MAX_COIL_VAL to the valve coil driver output
       functions will generate a runtime error.*/
    #define COIL_RELOAD  0x0FC00     /* 2.441 KHz output frequency*/
    #define MAX_COIL_VAL 0x003FE
    #define OFFSET_VAL   48
    
    /* The PWM outputs are controlled by CAPCOM channels 0 through 7. This word is
       programmed into registers CCM0 and CCM1 so that these channels operate in
       compare mode 3 and are allocated to timers T0 and T7.*/
    #define CCMX_INIT_PWM_OUTPUTS    0x07777;
    
    
    /* The DC outputs are controlled by CAPCOM channels 16 through 23. This word is
       programmed into registers CCM4 and CCM5 so that these channels operate in
       compare mode 2 and are allocated to timers T0 and T7.  In compare mode 2, the
       output pin is unaffected by an interrupt and therefor the output can be used
       as a dc output.*/
    #define CCMX_INIT_DC_OUTPUTS   0x06666;
    #define INIT_DC_OUPUT          0x06;
    
    
    

Children
No data