Space vector PWM and ASM translation


+ Reply to Thread
Results 1 to 2 of 2
  1. #1

    Question Space vector PWM and ASM translation

    Hello,

    I'm implementing Space Vector PWM in PBP in order to control with variable speed an 3-phase AC motor.

    The base of my work is the AN955 from Microchip.
    http://ww1.microchip.com/downloads/e...tes/00955a.pdf

    In order to modify the output frequency, you have to modify the speed of the rotating vector Vs. (page 3)

    So a "Degree_constant" is pre-defined (in my case 39)
    The "Required_motor_speed" is in my case 50
    So the "Vector_update_step_size" is 39*50=1950
    And "Vector_angle"="Vector_angle"+1950

    This is explained in page 8.

    But I don't really understand the source code provided, especially that "Carry" thing (in ASM) :

    Code:
    ;*************************************************************************************
    ;ISR FOR VECTOR ROTATION AND PHASE PWM DUTY CYCLE UPDATE
    ;*************************************************************************************
    ISR_PWM
    	BCF	PIR3,PTIF				;CLEAR PWM TIMER INTERUPT FLAG
    	BTFSS	ACSVM_FLAGS_1,FWD_REV
    	BRA	FIND_VECTOR_ANGLE_FOR_REV_DIR
    	MOVFF	PARAMETER_BUFFER+LOC_UPDATE_STEP_LSB,WREG	;INCREMENT VECTOR BY UPDATE STEP SIZE
    	ADDWF	VECTOR_ANGLE_LSB,F
    	MOVFF	PARAMETER_BUFFER+LOC_UPDATE_STEP_MSB,WREG
    	ADDWFC	VECTOR_ANGLE_MSB,F
    	BNC	READ_TIME_TB_COUNT			;DUE TO VECTOR INCREMENT, FOR CARRY = 0, CALCULATE CORRESPONDING TIME VALUES
    	INCF	SECTOR_NO,F				;DUE TO VECTOR INCREMENT, FOR CARRY = 1, INCREMENT SECTOR NO
    	BRA	CHECK_SECTOR_OF
    FIND_VECTOR_ANGLE_FOR_REV_DIR
    	MOVFF	PARAMETER_BUFFER+LOC_UPDATE_STEP_LSB,WREG
    	SUBWF	VECTOR_ANGLE_LSB,F
    	MOVFF	PARAMETER_BUFFER+LOC_UPDATE_STEP_MSB,WREG
    	SUBWFB	VECTOR_ANGLE_MSB,F
    	BC	READ_TIME_TB_COUNT
    	INCF	SECTOR_NO,F
    CHECK_SECTOR_OF
    	MOVLW	0X05
    	CPFSGT	SECTOR_NO
    	BRA	READ_TIME_TB_COUNT
    	CLRF	SECTOR_NO				;FOR SECTOR NO. ROLL OVER, REINITIALIZE SECTOR NO. TO 0
    READ_TIME_TB_COUNT
    [...]
    Can anyone would translate this ASM part of code in something more "PBPish"?

    Thanks
    Last edited by pxidr84; - 6th October 2014 at 09:53.

  2. #2

    Default Re: Space vector PWM and ASM translation

    Finally found myself the carry problem... just to have to read the STATUS system register.

    if STATUS.0=%1 then
    @ incf _sector
    STATUS.0=%0
    endif

Similar Threads

  1. Need more space, please...
    By fratello in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 23rd January 2012, 16:21
  2. how to remap interrupt vector - pic18f4550
    By cluster in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 10th November 2011, 03:21
  3. Help me about Space Vector Modulation
    By xuanhiendk2 in forum General
    Replies: 0
    Last Post: - 27th July 2009, 17:03
  4. Translation Problem
    By cyh_fax in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 23rd April 2007, 15:11
  5. Compactflash libraries translation
    By Moldava in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 5th October 2004, 00:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts