Microchip
直播中

魏紫瑜

7年用户 135经验值
私信 关注
[问答]

PWM故障不起作用

你好,我想使用PWM故障3。我的PWM代码是工作的,但故障3针是3.3,当它没有故障3。

以上来自于百度翻译


      以下为原文

    hi,
I want to  use pwm fault3  . My pwm  code is work but Fault 3 pin is  3.3 when it didn't  fault 3 .
this code  :     
    PTCONbits.PTEN =0;
    // ~~~~~~~~~~~~~~~~~~~~~~ PWM1 Configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    IOCON2bits.PENH = 0; // PWM1H is controlled by PWM module
    IOCON2bits.PENL = 0;
    IOCON3bits.PENH = 0; // PWM1H is controlled by PWM module
    IOCON3bits.PENL = 0;
     
    IOCON1bits.PENH = 1; // PWM1H is controlled by PWM module
    IOCON1bits.PENL = 1; // PWM1L is controlled by PWM module
    IOCON1bits.PMOD = 0; // Select Complementary Output PWM mode
    PWMCON1bits.ITB = 1; // PHASE1 provides the PWM time period value
    PWMCON1bits.CAM = 1; // Center-Aligned Mode
        
   PHASE1 = PWM1_PERIOD_VALUE;

   ALTDTR1 = PWM1_DEADTIME_VALUE;
   PDC1 = PWM1_INITIAL_VALUE;
    FCLCON1bits.FLTMOD = 3; //fault mode is disabled
    PTCON2 = 0;
// FAULT
       FCLCON1bits.FLTMOD = 1; // PWM generator pins for FLTDAT values (cycle-by-cycle condition)
      FCLCON1bits.IFLTMOD = 0; // Normal Fault Mode
      FCLCON1bits.FLTSRC = 9; // Select fault source FLT3,
      FCLCON1bits.FLTPOL = 0; // Fault input pin is set to active-low ////////
      IOCON1bits.FLTDAT = 0; // Shuts down PWM1L and PWM1H signals to inactive state
      PWMCON1bits.FLTIEN = 1; /* Enable fault interrupt */
      TRIG1 = 0; //Point at which the ADC module is to be triggered by primary PWM
      TRGCON1bits.TRGDIV = 0; // Trigger output divider set to trigger ADC on every trigger match event
      TRGCON1bits.TRGSTRT = 0; // First ADC trigger event occurs after ONE trigger match events
       PTCONbits.PTEN = 1;

回帖(3)

杜元晓

2019-7-3 11:05:00
在故障引脚上配置了数字输入缓冲区吗?还确保销处于三态。您的代码缺少两种设置(我不确定PIN 3是否具有模拟模式)。

以上来自于百度翻译


      以下为原文

    Have you configured digital input buffer on FAULT pin? Also ensure the pin is in tristate. Your code lacks both setups (I'm not sure pin 3 has analog mode though).
举报

杜元晓

2019-7-3 11:33:31
到底是什么芯片?你没有提到。

以上来自于百度翻译


      以下为原文

    What chip exactly? You've didn't mentioned.
举报

王文霞

2019-7-3 11:51:13
对不起的。我忘了。我的芯片DSIC33 EP32 MC204。

以上来自于百度翻译


      以下为原文

    Sorry . I forgot it . My chip dsPIC33ep32mc204.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分