18F4620 HPWM Half Bridge Mod problem


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2007
    Posts
    27

    Default 18F4620 HPWM Half Bridge Mod problem

    Hello my friends,
    I would like to drive two mosfets which are built Half Bridge. I have read whole forum but i can't succeed. The code and ISIS file is attached. The circuit on the proto board is tried but the result is negative. Only P1A is OK.

    Regards.
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    HPWM is intended for standard CCP PWM modules. It does not work for enhanced PWM
    modules. You'll need to set things up manually.

    I don't have an 18F4620 to test this with, but see if this doesn't work;
    Code:
    DEFINE	OSC 20
    
    Duty VAR WORD ' 5%=25, 95%=450
    
    TRISC.2=0
    TRISD.5=0
    
    T2CON = %00000101  ' Timer2 ON, prescale 1:4
    PR2 = 124          ' 10kHz
    CCP1CON = %10001100' half-bridge with P1A & P1B
    
    Loop:
      For Duty = 25 TO 450  ' from 5% to 95% duty
       CCP1CON.4 = Duty.0	' Setup 10-bit duty cycle as
       CCP1CON.5 = Duty.1	' a 10-bit word
       CCPR1L = Duty >> 2
       PAUSE 250
      Next
      Goto loop
    	
      End
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    May 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    I was fighting with a 18F4550 and it's 4 multiplexed PWM's (P1-P4). I had no time to study about it. My timeless and fast solution was I just used an ordinary pwm PIC (16F628a) and a (fast) 4052 multiplexer and forgot about enhanced pwm stuff for a 1/256th microstepper unipolar stepper motor controller I made. Also used a SN754410NE bridge.

    Cheap, fast & easy...

    (The 18F4550 i left it for another USB proyect)


    RodSTAR
    Last edited by RodSTAR; - 31st October 2007 at 17:23.

  4. #4
    Join Date
    Aug 2007
    Posts
    27


    Did you find this post helpful? Yes | No

    Unhappy

    Hi Bruce thank you for reply, It is not working. I think something is wrong or missing for this situation.

    Hi rodstar, that is possible. Deadtime is very important for me. I have to put a deadtime in the PWM signals.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Is it still only showing a PWM signal on P1A? Are you running this in ISIS or on a real PIC?
    More info would help.

    Edit: I ran this through MPSIM with the logic analyzer on P1A and P1B. Sure looks like it works.
    Code:
    DEFINE	OSC 20
    Duty VAR WORD ' 5%=25, 95% = 450
    TRISC.2=0
    TRISD.5=0
    T2CON = %00000101  ' Timer2 ON, prescale 1:4
    PR2 = 124          ' 10kHz
    CCP1CON = %10001100' half-bridge with P1A & P1B
    PWM1CON = %10001111' set dead-time
    
    Loop:
      For Duty = 25 TO 450  ' from 5% to 95% duty
       CCP1CON.4 = Duty.0	' Setup 10-bit duty cycle as
       CCP1CON.5 = Duty.1	' a 10-bit word
       CCPR1L = Duty >> 2
       PAUSEUS 24
      Next
      Goto loop
    	
      End
    Screen capture of MPSIM logic analyzer attached.

    Might be a problem with ISIS or your config settings?
    Attached Images Attached Images  
    Last edited by Bruce; - 31st October 2007 at 21:04.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    Aug 2007
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    Hi Bruce , Thank you for interest.

    The problem is not simulation. I have just tried your code on the proto board. It is not working. I programmed your code. Nothing was changed.

    Did you use some fuse setting that i didn't see in your code. I think something is wrong with this PIC model because my 18F458 and 16f690 and 16f684 is working Half bridge Mod properly in ISIS and proto board.

    Thank you again.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Here's the config settings I used when running this through MPSIM.

    __CONFIG _CONFIG1H, _OSC_HS_1H
    __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
    __CONFIG _CONFIG3H, _PBADEN_OFF_3H
    __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L

    I have attached the .hex & .bas files I used.

    After looking at one of many errata sheets for the 18F4620, I doubt I'll be in
    any huge hurry to try this one.

    The Rev A silicon Errata sheet shows a boat-load of problems with the ECCP
    module. It could very well be a silicon bug. Good luck...;o}
    Attached Files Attached Files
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8
    Join Date
    Aug 2007
    Posts
    27


    Did you find this post helpful? Yes | No

    Default

    Thank you very much for valuable helps. The last code was the same. I will research more. Maybe one mounth later i will work with other PIC wich have not got big bugs if I can't succeed.

    Best regards.

  9. #9
    Join Date
    Aug 2007
    Posts
    27


    Did you find this post helpful? Yes | No

    Angry

    18F458 is working very well with the same code but 18F4620 is not. I think there is a PIC bug.

Similar Threads

  1. Using HPWM in half bridge mode on 16f690
    By Chris Barron in forum mel PIC BASIC
    Replies: 0
    Last Post: - 29th December 2006, 11:18
  2. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 14:14
  3. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43
  4. HPWM problem .. pls help!
    By Samuel in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 1st February 2006, 15:30
  5. problem ont hpwm on the pic16f767!!
    By oscar in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 20th May 2005, 10:41

Members who have read this thread : 1

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