• AVR Freaks

Hot!dsPIC33EV complementary PWM enable/disable

Author
vikas kumar
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2015/01/08 15:06:38
  • Location: 0
  • Status: offline
2019/05/03 05:24:11 (permalink)
0

dsPIC33EV complementary PWM enable/disable

Hi,
 
I can able to generate PWM H/L using my dsPIC33EV. 
 
I would like to know how I can disable either High side or Low side. 
 
Do I need to use IOCONx ? Can I over ride the pin enable and disable function using IOCONx ?
 
For generating the PWM I use HAL function created by software engineer and I am now to PIC. 
#1

10 Replies Related Threads

    JPortici
    Super Member
    • Total Posts : 674
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: dsPIC33EV complementary PWM enable/disable 2019/05/03 08:51:49 (permalink)
    0
    Do I need to use IOCONx ?

    short answer: yes.
     
    long answer: define what you expect to happen when you "disable function"
    #2
    vikas kumar
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2015/01/08 15:06:38
    • Location: 0
    • Status: offline
    Re: dsPIC33EV complementary PWM enable/disable 2019/05/03 09:36:01 (permalink)
    0
    My application is brushed DC motor control
     
    I am using Full bridge and a gate driver to spin clockwise and anticlockwise direction according to the below document link. But they have driven MOSFET directly from the PIC. I am using gate drivers. 
     
    http://ww1.microchip.com/downloads/en/AppNotes/00000893B.pdf

    As per page 4 and 5 , I need to know how to disable two PWM , enable one to high and fourth one a PWM signal with carying duty. 
     
    I know i need to use independent PWM control but not sure how to use in dsPIC33ev25gm106 as I dont see independent PWM on PMOD register. 
     
     
     
    #3
    JPortici
    Super Member
    • Total Posts : 674
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: dsPIC33EV complementary PWM enable/disable 2019/05/06 00:22:24 (permalink)
    3.67 (3)
    That's because unfortunately there is no independent mode in the 33EV, you'll have to use two channels if you need independent control
    #4
    Javier Lopez
    Pulsotron designer
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2019/02/27 09:59:32
    • Location: Spain
    • Status: offline
    Re: dsPIC33EV complementary PWM enable/disable 2019/05/07 01:47:33 (permalink)
    0
    I used a lot of independents PWM in dspic33EV604 by using MPLABX easy configurator programing "independent mode",
    FCLCON1 = FCLCON2 = FCLCON3 = FCLCON4 = FCLCON5 = FCLCON6 = 0x0003;
    and after that I can make 
    PHASE1 = 0x10; to make phase of 1H and
    SPHASE=0x20; to make phase of 1L
     
    and the duty cycle is:
    PDC1=k_1H*PTPER; to make duty cycle of 1H percentage is k_1H (where k_1H goes from 0 to 1)
    For the 1L:
    SDC1=k_1L*PTPER;
     
    There are a lot of pwms: 6H,6L,5H,5L,... Smile: Smile
     
     
     
    #5
    JPortici
    Super Member
    • Total Posts : 674
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: dsPIC33EV complementary PWM enable/disable 2019/05/07 02:18:07 (permalink)
    5 (2)
    Gee, thanks for the one star but you should re-read the OP.
    First, there is no such thing as a dsPIC33EV604. Unless you have a device which is not available to us mortals, but based on your other thread you are referring to a dsPIC33EP604 which, again, doesn't tell us much, i can assume it's a dsPIC33EP128GM604
    the dsPIC33EV series, instead, such as the dsPIC33EV256GM106 is from a different series of microcontrollers (EV: Enchanced Voltage) and it refers to the family datasheet DS70005144G
     
    To highlight the differences in the HSPWM relevant to this thread, the 33EV series has only 3 pairs of HSPWM (not six.) and as the datasheet will tell you, 0b11 is a reserved value in the PMOD field of IOCON register, which means that Ture Independent Mode is not available.
    #6
    vikas kumar
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2015/01/08 15:06:38
    • Location: 0
    • Status: offline
    Re: dsPIC33EV complementary PWM enable/disable 2019/05/17 04:42:08 (permalink)
    0
    Hi JPortici,
     
    You are correct. There is no independent PWM mode. But fortunately I dont need it as my application is only brushed DC control and I can use only PWMXH and GPIO control.
     
    I am doing PWM control and as mentioned earlier its for brushed DC motor control and I am using full bridge.

    As you know the control logic for the brushed DC motor , I would like to know how I can disable only one one module like PWM 1 (dsPIC33EV have 3 PWM - PWM 1, PWM 2 , PWM 3)

    There is a register PTEN where setting it will disable all the 3 module.

    But I need to disable only one . example PWM1L and PWM1H.

    How do I do it ?
     
    What register do I need to set to do it ?
    #7
    Aussie Susan
    Super Member
    • Total Posts : 3559
    • Reward points : 0
    • Joined: 2008/08/18 22:20:40
    • Location: Melbourne, Australia
    • Status: offline
    Re: dsPIC33EV complementary PWM enable/disable 2019/05/19 19:42:55 (permalink)
    4 (1)
    You answered your own question in your first post.
    I also provided the same information this morning at https://www.edaboard.com/showthread.php?383778-PIC24-PWM-Input-read.
    Susan
    #8
    vikas kumar
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2015/01/08 15:06:38
    • Location: 0
    • Status: offline
    Re: dsPIC33EV complementary PWM enable/disable 2019/05/21 11:26:01 (permalink)
    0
    Hi Susan,
     
    I already looked at that section and implemented the code but still I dont see the PWM1H or PWM1L output goes low. Still the signal is ON on both PWMxH and PWMxL. For my application its not a big deal as I can left this pin no connection but I wonder why I can't implement it in software.

    Also reference to the section 14.12 (and 14.12.6), It says "halted by the Debugger". Is it during debug mode, where I use break point to check each line of the code ? If that is the case I am not after that , I would like to disable the PWMxH and PWMxL during run time.

    I have attached the section of the code that I used to implement PEM1H and PWM1L disable


    Below code implemented under main.C
    TRISBbits.TRISB12 = 0;
    TRISBbits.TRISB13 = 0;
    TRISBbits.TRISB14 = 0;
    TRISBbits.TRISB15 = 0;

    LATBbits.LATB12 = 0;
    LATBbits.LATB13 = 0;
    LATBbits.LATB14 = 0;
    LATBbits.LATB15 = 0;


    Below code implemented under PWM.C


    PWMCON1 = 0x0000;


    PWMCON2 = 0x0000
    #9
    Aussie Susan
    Super Member
    • Total Posts : 3559
    • Reward points : 0
    • Joined: 2008/08/18 22:20:40
    • Location: Melbourne, Australia
    • Status: offline
    Re: dsPIC33EV complementary PWM enable/disable 2019/05/21 19:40:50 (permalink)
    0
    14.12.6 is the only part of 14.12 that mentions the debug break - all of the rest doesn't.
    You need to show us all of the code, not just some random lines.
    And please use code tags so that the code is more readable.
    Susan
    #10
    vikas kumar
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2015/01/08 15:06:38
    • Location: 0
    • Status: offline
    Re: dsPIC33EV complementary PWM enable/disable 2019/05/22 09:17:25 (permalink)
    0
    I have attached code on the following thread
    Please have a look.
    https://www.edaboard.com/showthread.php?383778-PIC24-PWM-Input-read
     
    Thanks.
     
    Regards,
    Vikash
    #11
    Jump to:
    © 2019 APG vNext Commercial Version 4.5