![Microchip Technology AN908 Скачать руководство пользователя страница 49](http://html1.mh-extra.com/html/microchip-technology/an908/an908_using-manual_1785807049.webp)
2004 Microchip Technology Inc.
DS00908A-page 49
AN908
ClarkePark.s
;*******************************************************************
; ClarkePark
;
;Description:
; Calculate Clarke & Park transforms.
; Assumes the Cos and Sin values are in qSin & qCos.
;
;
Ialpha = Ia
;
Ibeta = Ia*dOn 2*Ib*dOneBySq3;
;
where Ia+Ib+Ic = 0
;
;
Id = Ialpha*cos(Angle) + Ibeta*sin(Angle)
;
Iq = -Ialpha*sin(Angle) + Ibeta*cos(Angle)
;
; This routine works the same for both integer scaling and 1.15 scaling.
;
;Functional prototype:
;
; void ClarkePark( void )
;
;On Entry: ParkParm structure must contain qSin, qCos, qIa and qIb.
;
;On Exit: ParkParm will contain qId, qIq
;
;Parameters:
; Input arguments: None
;
; Return:
; Void
;
; SFR Settings required:
; CORCON.SATA = 0
; If there is any chance that (Ia+2*Ib)/sqrt(3) will overflow must set
; CORCON.SATDW = 1
;
; Support routines required: None
;
; Local Stack usage: None
;
; Registers modified: w3 -> w7
;
; Timing: 20 cycles
;
;*******************************************************************
;
.include "general.inc"
; External references
.include "park.inc"
; Register usage
.equ ParmW,
w3
; Ptr to ParkParm structure
.equ Sq3W,
w4
; OneBySq3
.equ SinW,
w4
; replaces Work0W
.equ CosW,
w5
.equ IaW,
w6
; copy of qIa
.equ IalphaW,
w6
; replaces Ia
.equ IbW,
w7
; copy of qIb
.equ IbetaW,
w7
; Ibeta replaces Ib