![Microchip Technology AN908 Using Manual Download Page 60](http://html1.mh-extra.com/html/microchip-technology/an908/an908_using-manual_1785807060.webp)
AN908
DS00908A-page 60
2004 Microchip Technology Inc.
OpenLoop.s
;*******************************************************************
; Routines: OpenLoop
;*******************************************************************
; Common to all routines in file
.include "general.inc"
.include "openloop.inc"
;*******************************************************************
; OpenLoop
;
;Description:
;Equations:
;
qDeltaFlux = Kdelta * qVelMech
;
qAngFlux = qA Kdelta * qVelMech
;; rotor flux angle
;
;
qKdelta = (2^15) * 2 * iPoles * fLoopPeriod * fScaleMechRPS
;
where qVelMech is the mechanical velocity in RPS scaled by fScaleMechRPS
;
and the iPoles is required to get Flux vel from Mech vel
;
and the 2 is to scale +/- 2*pi into +/- pi
;Functional prototype:
;
; void OpenLoop( void )
;
;On Entry: OpenLoopParm structure must contain
;
;On Exit: OpenLoopParm will contain
;
;Parameters:
; Input arguments:
None
;
; Return:
; Void
;
; SFR Settings required:
;
CORCON.SATA
= 0
;
CORCON.IF
= 0
;
; Support routines required: None
; Local Stack usage:
0
; Registers modified: ??w4,w5,AccA
; Timing:
??8 instruction cycles
;*******************************************************************
;
;=================== CODE =====================
.section .text
; Register usage for OpenLoop
.equ Work0W,
w4
; Working register
.equ Work1W,
w5
; Working register
.global
_OpenLoop
.global
OpenLoop