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

📄 snsles2431.lst

📁 汇编语言开发的BLDC驱动程序。 基于PIC18F1330单片机。
💻 LST
📖 第 1 页 / 共 5 页
字号:
MPASM  5.15                    SNSLES2431.ASM   2-22-2008  14:34:38         PAGE  1


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00001 ;******************************************************************************
                      00002 ;
                      00003 ; Software License Agreement                                         
                      00004 ;                                                                    
                      00005 ; The software supplied herewith by Microchip Technology             
                      00006 ; Incorporated (the "Company") is intended and supplied to you, the  
                      00007 ; Company抯 customer, for use solely and exclusively on Microchip    
                      00008 ; products. The software is owned by the Company and/or its supplier,
                      00009 ; and is protected under applicable copyright laws. All rights are   
                      00010 ; reserved. Any use in violation of the foregoing restrictions may   
                      00011 ; subject the user to criminal sanctions under applicable laws, as   
                      00012 ; well as to civil liability for the breach of the terms and         
                      00013 ; conditions of this license.                                        
                      00014 ;                                                                     
                      00015 ; THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,  
                      00016 ; WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED  
                      00017 ; TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A       
                      00018 ; PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,  
                      00019 ; IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR         
                      00020 ; CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.       
                      00021 ;
                      00022 ;*********************************************************************************
                      00023 ;-----------------------------------------------------------------
                      00024 ;This program is used for sensorless control of BLDC motor.
                      00025 ;Hardwrae used is PICDEM MC LV board.
                      00026 ;Motor used for testing is NTDynamo Hurst motor. 
                      00027 ;Theory and implementation is expalined in application note AN970
                      00028 ;Motor connections to the board is as follows:
                      00029 ;Motor power connection(White square connector with 4 wires)
                      00030 ;Red : connect to M1 on J9 on the board 
                      00031 ;White : connect to M2 on J9 on the board 
                      00032 ;Black : connect to M3 on J9 on the board 
                      00033 ;Green : connect to G on J9 on the board 
                      00034 ;-----------------------------------------------------------------
                      00035 ;       Author  : Padmaraja Yedamle
                      00036 ;                       : Home Appliance Solutions Group
                      00037 ;                       : Microchip Technology Inc
                      00038 ;       Date    : June-25-2004
                      00039 ;
                      00040 ;******************************************************************
                      00041         include         "snsrles_DATA.inc"
                      00001 ;This file is used for defining the variables and compile time options
                      00002 ;This file should be included in all .asm/.c files
                      00003 ;Author : Padmaraja Yedamale
                      00004 ;Version: V1.1
                      00005 
                      00006         include         "P18F2431.inc"
                      00001         LIST
                      00002 
                      00003 ;==========================================================================
                      00004 ;  $Id: P18F2431.INC,v 1.11.2.3 2006/03/03 20:51:38 curtiss Exp $
                      00005 ;  MPASM PIC18F2431 processor include
                      00006 ; 
MPASM  5.15                    SNSLES2431.ASM   2-22-2008  14:34:38         PAGE  2


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00007 ;  (c) Copyright 1999-2006 Microchip Technology, All rights reserved
                      00008 ;==========================================================================
                      00009 
                      01332         LIST
                      00007 
                      00008 ;User defined variables
                      00009 ;---------------------------------------------------------------------------------------
                      00010 ;Oscillator frequency
                      00011 #define OSCILLATOR      d'20000000'
                      00012 ;---------------------------------------------------------------------------------------
                      00013 ;Enter the PPR of the Optical Encoder on the motor
                      00014 #define ENCODER_PPR d'1024'
                      00015 ;---------------------------------------------------------------------------------------
                      00016 ;Claculating RPM based on the encoder type. The QEI should be in velocity measurement mode
                      00017 ;Timer5 prescaler
                      00018 #define TIMER5_PRESCALE d'1'
                      00019 ;---------------------------------------------------------------------------------------
                      00020 ;Define the QEI mode of operation. 
                      00021 ;If the velocity conter is updated only on QEA transition, then enable 2x mode
                      00022 ;If the velocity conter is updated every QEA and QEB transition, then enable 4x mode
                      00023 #define QEI_X_UPDATE d'2'
                      00024 ;#define QEI_X_UPDATE d'4'
                      00025 ;---------------------------------------------------------------------------------------
                      00026 ;Define Velocity pulse decimation ratio(Only one line should be selected)
                      00027 #define VELOCITY_PULSE_DECIMATION d'1' 
                      00028 ;#define VELOCITY_PULSE_DECIMATION d'4' 
                      00029 ;#define VELOCITY_PULSE_DECIMATION d'16' 
                      00030 ;#define VELOCITY_PULSE_DECIMATION d'64' 
                      00031 ;---------------------------------------------------------------------------------------
                      00032 ;Calculate the constant to be divided by the Velocity counter value will give RPS
                      00033 #define INSTRUCTION_CYCLE  ((OSCILLATOR)/d'4')
                      00034 ;INSTRUCTION_CYCLE = (OSCILLATOR)/d'4'
  00004C48            00035 RPM_CONSTANT_QEI = 8*((INSTRUCTION_CYCLE)/(ENCODER_PPR*QEI_X_UPDATE*VELOCITY_PULSE_DECIMATION*TIMER5_PRE
                            SCALE))
                      00036 ;The value is multiplied by 8 to increase the accuracy of division. After devision, the result is devide
                            d by 8
  0000CB73            00037 RPM_CONSTANT_HALL = INSTRUCTION_CYCLE/(d'12'*d'8')
                      00038 ;60 to convert RPM to RPS, 12= # of Hall pulses/revolution
                      00039 ;---------------------------------------------------------------------------------------
                      00040 ;PWM frequency definition
                      00041 #define PWM_TIMER_PRESCALE      d'01'
                      00042 #define PWM_FREQUENCY   d'16000'
  00000137            00043 PTPER_VALUE = (OSCILLATOR/(4*PWM_FREQUENCY*PWM_TIMER_PRESCALE))-1
                      00044 ;---------------------------------------------------------------------------------------
                      00045 ;Defining the PWM duty cycle constant based on the Motor voltage, DC bus voltage and PWM period register
                             value
                      00046 #define MOTOR_VOLTAGE d'15'
                      00047 #define DC_INPUT_VOLTAGE        d'15'
                      00048 #define MOTOR_RATED_SPEED d'2500'
                      00049 
                      00050 ;#define MAIN_PWM_CONSTANT ((MOTOR_VOLTAGE*PTPER_VALUE*4*d'16')/(DC_INPUT_VOLTAGE*d'250'))
                      00051 #define MAIN_PWM_CONSTANT ((MOTOR_VOLTAGE*PTPER_VALUE*4*d'16')/(DC_INPUT_VOLTAGE*d'250'))
                      00052 
MPASM  5.15                    SNSLES2431.ASM   2-22-2008  14:34:38         PAGE  3


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00053 ;MAIN_PWM_CONSTANT =(MOTOR_VOLTAGE*PTPER_VALUE*4*d'16')/(DC_INPUT_VOLTAGE*d'250')       ;256
                      00054 ;1.414*256 = 360
                      00055 ;Multiplication factor = 16
  00000008            00056 ERROR_PWM_CONSTANT = (MAIN_PWM_CONSTANT * d'256')/MOTOR_RATED_SPEED
  00000372            00057 MAX_PWM_VALUE = (MOTOR_VOLTAGE*PTPER_VALUE*4*d'100')/(DC_INPUT_VOLTAGE* d'141')
                      00058 ;---------------------------------------------------------------------------------------
  00002711            00059 ESTIMATE_TIMER_CONSTANT = ((d'60'* INSTRUCTION_CYCLE)/(MOTOR_RATED_SPEED*d'12'))+1
                      00060 
                      00061 ;-------------------------------
                      00062 ;Commutation table. loaded to OVDCOND
                      00063 ;-------------------------------
                      00064 ; The Hall sensor makes a transition every 60 degrees
                      00065 ; For other type of motors with different Hall sensor combination, the table has to be modified.
                      00066 
                      00067 ;Position old
                      00068 ;#define        POSITION0       b'00000000'
                      00069 ;#define        POSITION1       b'00010010'
                      00070 ;#define        POSITION2       b'00100100'
                      00071 ;#define        POSITION3       b'00000110'
                      00072 ;#define        POSITION4       b'00001001'
                      00073 ;#define        POSITION5       b'00011000'
                      00074 ;#define        POSITION6       b'00100001'
                      00075 ;#define        POSITION7       b'00000000'
                      00076 
                      00077 
                      00078 ;new2 -60 Best perf
                      00079 
                      00080 
                      00081 #define POSITION0       b'00000000' ;This will be loaded to OVDCOND register when HallA=0,HallB=0,HallC=
                            0
                      00082 #define POSITION1       b'00010010' ;This will be loaded to OVDCOND register when HallA=0,HallB=0,HallC=
                            1
                      00083 #define POSITION2       b'00001001' ;This will be loaded to OVDCOND register when HallA=1,HallB=0,HallC=
                            0
                      00084 #define POSITION3       b'00011000' ;This will be loaded to OVDCOND register when HallA=1,HallB=0,HallC=
                            1
                      00085 #define POSITION4       b'00100100' ;This will be loaded to OVDCOND register when HallA=0,HallB=1,HallC=
                            0
                      00086 #define POSITION5       b'00000110' ;This will be loaded to OVDCOND register when HallA=0,HallB=1,HallC=
                            1
                      00087 #define POSITION6       b'00100001' ;This will be loaded to OVDCOND register when HallA=1,HallB=1,HallC=
                            0
                      00088 #define POSITION7       b'00000000' ;This will be loaded to OVDCOND register when HallA=1,HallB=1,HallC=
                            1
                      00089 
                      00090 ;new1
                      00091 #define POSITION01      b'00000000' ;This will be loaded to OVDCOND register when HallA=0,HallB=0,HallC=
                            0
                      00092 #define POSITION11      b'00110000' ;This will be loaded to OVDCOND register when HallA=0,HallB=0,HallC=
                            1
                      00093 #define POSITION21      b'00010100' ;This will be loaded to OVDCOND register when HallA=1,HallB=0,HallC=
                            0
                      00094 #define POSITION31      b'00000110' ;This will be loaded to OVDCOND register when HallA=1,HallB=0,HallC=
MPASM  5.15                    SNSLES2431.ASM   2-22-2008  14:34:38         PAGE  4


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                            1
                      00095 #define POSITION41      b'00100011' ;This will be loaded to OVDCOND register when HallA=0,HallB=1,HallC=
                            0
                      00096 #define POSITION51      b'00001001' ;This will be loaded to OVDCOND register when HallA=0,HallB=1,HallC=
                            1
                      00097 #define POSITION61      b'00101000' ;This will be loaded to OVDCOND register when HallA=1,HallB=1,HallC=
                            0
                      00098 #define POSITION71      b'00000000' ;This will be loaded to OVDCOND register when HallA=1,HallB=1,HallC=
                            1
                      00099 
                      00100 ;new1
                      00101 ;#define        POSITION01      b'00000000' ;This will be loaded to OVDCOND register when HallA=0,HallB=
                            0,HallC=0
                      00102 ;#define        POSITION41      b'00001001' ;This will be loaded to OVDCOND register when HallA=1,HallB=
                            0,HallC=0
                      00103 ;#define        POSITION61      b'00100100' ;This will be loaded to OVDCOND register when HallA=0,HallB=
                            1,HallC=0
                      00104 ;#define        POSITION51      b'00100001' ;This will be loaded to OVDCOND register when HallA=1,HallB=
                            1,HallC=0
                      00105 ;#define        POSITION21      b'00010010' ;This will be loaded to OVDCOND register when HallA=0,HallB=
                            0,HallC=1
                      00106 ;#define        POSITION31      b'00011000' ;This will be loaded to OVDCOND register when HallA=1,HallB=
                            0,HallC=1
                      00107 ;#define        POSITION11      b'00000110' ;This will be loaded to OVDCOND register when HallA=0,HallB=
                            1,HallC=1
                      00108 ;#define        POSITION71      b'00000000' ;This will be loaded to OVDCOND register when HallA=1,HallB=
                            1,HallC=1
                      00109 
                      00110 
                      00111 ;Hurst Motor connection:
                      00112 ;Power :
                      00113 ; M1 : White
                      00114 ; M2 : Black
                      00115 ; M3 : Red
                      00116 ; G : Green
                      00117 ;Hall sensors:
                      00118 ;HA : White
                      00119 ;HB : Brown
                      00120 ;HC : Green
                      00121 ;+5V : Red
                      00122 ;GND : Black
                      00123 
                      00124 
                      00125 ;---------------------------------------------------------------------------------------
                      00126 
                      00127 #ifndef ANSEL1     
                      00128 ANSEL1           EQU  H'0FB9'
                      00129 #endif
                      00130 
                      00131 #define LOW_OL_SPEEDH 0x69   ;650
                      00132 #define LOW_OL_SPEEDL 0xc1
                      00133 
                      00134 

⌨️ 快捷键说明

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