⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 encoder.inc

📁 Source Code for Sensorless FOC for PMSM with PFC for dsPIC30F6010A
💻 INC
字号:
;;------------------  ASM30 API for Encoder routines ---------------------
; EncoderParm stucture:

          .equ Encod_qMechAng,0      ; Mechanical rotational angle in 1.15 format      
          .equ Encod_qKang,2         ; Constant: Count to Angle scaling                
          .equ Encod_iCntsPerRev,4   ; Constant: Encoder counts per revolution of motor
                                                                                       
          .equ Encod_qVelMech,6      ; Mechanical rotational velocity in 1.15          
          .equ Encod_qKvel,8         ; Constant: Count to velocity scaling             
          .equ Encod_iIrpPerCalc,10      ; Constant: Number of timer ticks per speed calc  

     ;; private

          .equ Encod_iVelCntDwn,12   ; Countdown to next speed calc
          .equ Encod_iPrevCnt,14     ; Last encoder value
          .equ Encod_iAccumCnt,16    ; Accumulating cnts
          .equ Encod_iDeltaCnt,18;   ; Accumulated cnts waiting for Velocity calc

          .extern _EncoderParm

; See discussion in CalcAng.s for proper value of Nang.
          .equ Nang,8         ; Nang must satisfy 64 <= 2^Nang < CntsPerRev

; Angular velocity scaling:  iVelMech = qKvel * DeltaCnt / 2^Nvel
;
; where qKvel = (2^15)*(2^Nvel)/MaxDeltaCnt.
;
; The Nvel scaling factor is picked to maximize precision without causing 
; qKvel to overflow 1.15 format. To do this Nvel must be small enough so that 
; 2^Nvel/MaxDeltaCnt < 1 but large enough to provide required precision.

; Assume MaxDeltaCnt > 256 => Nvel = 8
          .equ Nvel,8           ; Nvel must be in range -8 <= 15-Nvel <= +7
                                ; Must be changed in encoder.h also

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -