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

📄 imvc07.asm

📁 2407的交流电机控制程序
💻 ASM
字号:
*******************************************************
* TMS320C2x/C2xx/C5x ANSI C Codegen Version 7.00       
*******************************************************
;	d:\tic2xx\c2000\cgtools\bin\dspac.exe -v2xx -q -x0 D:\Imvc\IMVC07.c C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\IMVC07.if 
;	d:\tic2xx\c2000\cgtools\bin\dspopt.exe -v2xx -q -I0 -s -O0 C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\IMVC07.if C:\DOCUME~1\ADMINI~1\LOC
;	d:\tic2xx\c2000\cgtools\bin\dspcg.exe -o -v2xx -q C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\IMVC07.opt IMVC07.asm C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\IMVC07.tmp 
	.port
	.bss	_old_pos,1,1
	.bss	_stop,1
	.bss	_new_pos,1
	.file	"D:\Imvc\IMVC07.c"
	.file	"IMVC07h.h"
	.globl	_position
	.globl	_pwm_period
	.globl	_ad_res_0
	.globl	_ad_res_1
	.globl	_offset_ia
	.globl	_offset_ib
	.globl	_fast_max_count
	.globl	_middle_max_count
	.globl	_slow_max_count
	.globl	_pos_ref
	.globl	_pos
	.globl	_Kps_pos
	.globl	_Kis_pos
	.globl	_pos_ref_1
	.globl	_pos_1
	.globl	_e_pos_1
	.globl	_I_pos_1_high
	.globl	_I_pos_1_low
	.globl	_omg_ref
	.globl	_omg_ref_low
	.globl	_omg
	.globl	_Kps_omg
	.globl	_sf_P_omg
	.globl	_Kis_omg
	.globl	_sf_I_omg
	.globl	_omg_ref_1
	.globl	_omg_1
	.globl	_e_omg_1
	.globl	_I_omg_1_high
	.globl	_I_omg_1_low
	.globl	_i_q_ref
	.globl	_iq_ref_low
	.globl	_i_a
	.globl	_i_b
	.globl	_i_alpha
	.globl	_i_beta
	.globl	_i_d
	.globl	_i_q
	.globl	_u_d_ref
	.globl	_u_q_ref
	.globl	_u_alpha_ref
	.globl	_u_beta_ref
	.globl	_u_dc_ref
	.globl	_u_a_ref
	.globl	_u_b_ref
	.globl	_u_c_ref
	.globl	_theta
	.globl	_sin_theta
	.globl	_cos_theta
	.globl	_i_d_ref
	.globl	_Kps_id
	.globl	_sf_P_id
	.globl	_Kis_id
	.globl	_sf_I_id
	.globl	_id_ref_1
	.globl	_id_1
	.globl	_e_id_1
	.globl	_I_id_1_high
	.globl	_I_id_1_low
	.globl	_ud_ref_low
	.globl	_Kps_iq
	.globl	_sf_P_iq
	.globl	_Kis_iq
	.globl	_sf_I_iq
	.globl	_iq_ref_1
	.globl	_iq_1
	.globl	_e_iq_1
	.globl	_I_iq_1_high
	.globl	_I_iq_1_low
	.globl	_uq_ref
	.globl	_uq_ref_low
	.globl	_crt_comp
	.globl	_ctrl_ps_per
	.globl	_ctrl_crt_per
	.globl	_ctrl_pos_per
	.globl	_log_table
	.globl	_log_indx
	.globl	_log_size
	.globl	_log_count
	.globl	_log_time
	.globl	_log_p
	.globl	_ref_long
	.globl	_ref_indx
	.globl	_ref_time
	.globl	_ref_cycles
	.globl	_ref_time_val
	.globl	_ref_HL
	.globl	_C_slip
	.globl	_C_omg
	.globl	_Sh_omg
	.globl	_Sh_slip
	.globl	_theta_low
	.globl	_theta_inc
	.globl	_flag_active_fast
	.globl	_flag_active_middle
	.globl	_flag_active_slow
	.globl	_counter_fast
	.globl	_counter_middle
	.globl	_counter_slow
	.globl	_init_pdpint
	.globl	__pdpint_rti
	.globl	_InitializeKernel
	.globl	_init_IO_registers
	.globl	_init_encoder
	.globl	_init_pwm
	.globl	_init_adc
	.globl	_init_ctr_ps
	.globl	_init_ctr_crt
	.globl	_init_ctr_pos
	.globl	_get_ia_ib_offsets
	.globl	_logger
	.globl	_init_logger
	.globl	_init_reference
	.globl	_update_ref
	.globl	_ref_pos
	.globl	_init_field_pos
	.globl	_reset_Error_ACPM
	.globl	_read_int_adc
	.globl	_update_pwm
	.globl	_start_pwm
	.globl	_tabcdq
	.globl	_tdqabc
	.globl	_start_ctr_ps
	.globl	_start_ctr_crt
	.globl	_start_ctr_pos
	.globl	_start_encoder
	.globl	_read_encoder
	.globl	_loadsatvals
	.globl	_sine
	.globl	_cfgiopb1
	.globl	_setiopb1
	.globl	_resetiopb1
	.globl	_wait_state
	.globl	_ISR_Kernel
	.file	"D:\Imvc\IMVC07.c"
	.globl	_new_pos
	.globl	_old_pos
	.globl	_stop
	.text

	.sym	_rtc_slow_int,_rtc_slow_int,32,2,0
	.globl	_rtc_slow_int

	.func	52
******************************************************
* FUNCTION DEF : _rtc_slow_int
******************************************************
_rtc_slow_int:
	CALL	I$$SAVE
	SAR	AR1,*
	LARK	AR0,1
	LAR	AR0,*0+

*** 54	-----------------------    asm(" CLRC INTM");
	.line	3
 CLRC INTM
*** 56	-----------------------    read_encoder();
	.line	5
	CALL	_read_encoder
*** 57	-----------------------    pos = position;
	.line	6
	LDPK	_position
	BLDD	_position,#_pos
*** 58	-----------------------    pos_ref = reference();
	.line	7
	CALL	_reference
	LDPK	_pos_ref
	SACL	_pos_ref
*** 59	-----------------------    pi_reg_pos();
	.line	8
	CALL	_pi_reg_pos
*** 60	-----------------------    logger();
	.line	9
	CALL	_logger
***  	-----------------------    return;
EPI0_1:
	.line	10
	SBRK	1
	B	I$$REST,AR1   ;and return

	.endfunc	61,000000000H,1

	.sym	_rtc_middle_int,_rtc_middle_int,32,2,0
	.globl	_rtc_middle_int

	.func	70
******************************************************
* FUNCTION DEF : _rtc_middle_int
******************************************************
_rtc_middle_int:
	CALL	I$$SAVE
	SAR	AR1,*
	LARK	AR0,1
	LAR	AR0,*0+

*** 72	-----------------------    read_encoder();
	.line	3
	CALL	_read_encoder
*** 73	-----------------------    new_pos = position;
	.line	4
	LDPK	_position
	BLDD	_position,#_new_pos
*** 74	-----------------------    asm(" CLRC INTM");
	.line	5
 CLRC INTM
*** 75	-----------------------    omg = new_pos-old_pos;
	.line	6
	LDPK	_new_pos
	LAC	_new_pos
	SUB	_old_pos
	LDPK	_omg
	SACL	_omg
*** 76	-----------------------    pi_reg_omg();
	.line	7
	CALL	_pi_reg_omg
*** 77	-----------------------    i_d_ref = 4309;
	.line	8
	LDPK	_i_d_ref
	SPLK	#4309,_i_d_ref
*** 78	-----------------------    logger();
	.line	9
	CALL	_logger
*** 79	-----------------------    old_pos = new_pos;
	.line	10
	LDPK	_new_pos
	BLDD	_new_pos,#_old_pos
***  	-----------------------    return;
EPI0_2:
	.line	11
	SBRK	1
	B	I$$REST,AR1   ;and return

	.endfunc	80,000000000H,1

	.sym	_rtc_fast_int,_rtc_fast_int,32,2,0
	.globl	_rtc_fast_int

	.func	89
******************************************************
* FUNCTION DEF : _rtc_fast_int
******************************************************
_rtc_fast_int:
	CALL	I$$SAVE
	SAR	AR1,*
	LARK	AR0,1
	LAR	AR0,*0+

*** 91	-----------------------    get_adc_pair1();
	.line	3
	CALL	_get_adc_pair1
*** 92	-----------------------    i_a = offset_ia-ad_res_0;
	.line	4
	LDPK	_offset_ia
	LAC	_offset_ia
	LDPK	_ad_res_0
	SUB	_ad_res_0
	LDPK	_i_a
	SACL	_i_a
*** 93	-----------------------    i_b = offset_ib-ad_res_1;
	.line	5
	LDPK	_offset_ib
	LAC	_offset_ib
	LDPK	_ad_res_1
	SUB	_ad_res_1
	LDPK	_i_b
	SACL	_i_b
*** 94	-----------------------    tabcdq();
	.line	6
	CALL	_tabcdq
*** 95	-----------------------    pi_reg_id();
	.line	7
	CALL	_pi_reg_id
*** 96	-----------------------    pi_reg_iq();
	.line	8
	CALL	_pi_reg_iq
*** 97	-----------------------    tdqabc();
	.line	9
	CALL	_tdqabc
*** 98	-----------------------    update_field_pos();
	.line	10
	CALL	_update_field_pos
*** 99	-----------------------    update_pwm();
	.line	11
	CALL	_update_pwm
***  	-----------------------    return;
EPI0_3:
	.line	12
	SBRK	1
	B	I$$REST,AR1   ;and return

	.endfunc	100,000000000H,1

	.sym	_main,_main,32,2,0
	.globl	_main

	.func	105
******************************************************
* FUNCTION DEF : _main
******************************************************
_main:
	POPD	*+
	SAR	AR0,*+
	SAR	AR1,*
	LARK	AR0,1
	LAR	AR0,*0+

*** 108	-----------------------    stop = 0;
	.line	4
	LACK	0
	LDPK	_stop
	SACL	_stop
*** 110	-----------------------    ctrl_crt_per = 3000u;
	.line	6
	LDPK	_ctrl_crt_per
	SPLK	#3000,_ctrl_crt_per
*** 111	-----------------------    ctrl_ps_per = 30000u;
	.line	7
	LDPK	_ctrl_ps_per
	SPLK	#30000,_ctrl_ps_per
*** 112	-----------------------    ctrl_pos_per = 18928u;
	.line	8
	LDPK	_ctrl_pos_per
	SPLK	#18928,_ctrl_pos_per
*** 113	-----------------------    fast_max_count = 2;
	.line	9
	LACK	2
	LDPK	_fast_max_count
	SACL	_fast_max_count
*** 114	-----------------------    if ( fast_max_count > 2 ) goto g2;
	.line	10
	SSXM
	LAC	_fast_max_count
	SUBK	2
	BGZ	L2
*** 114	-----------------------    fast_max_count = 2;
	LACK	2
	SACL	_fast_max_count
L2:
***	-----------------------g2:
*** 115	-----------------------    middle_max_count = 20;
	.line	11
	LACK	20
	LDPK	_middle_max_count
	SACL	_middle_max_count
*** 116	-----------------------    if ( middle_max_count > 20 ) goto g4;
	.line	12
	LAC	_middle_max_count
	SUBK	20
	BGZ	L4
*** 116	-----------------------    middle_max_count = 20;
	LACK	20
	SACL	_middle_max_count
L4:
***	-----------------------g4:
*** 117	-----------------------    slow_max_count = 100;
	.line	13
	LACK	100
	LDPK	_slow_max_count
	SACL	_slow_max_count
*** 118	-----------------------    if ( slow_max_count > 100 ) goto g6;
	.line	14
	LAC	_slow_max_count
	SUBK	100
	BGZ	L6
*** 118	-----------------------    slow_max_count = 100;
	LACK	100
	SACL	_slow_max_count
L6:
***	-----------------------g6:
*** 120	-----------------------    Init_SCSR_WS();
	.line	16
	CALL	_Init_SCSR_WS
*** 121	-----------------------    reset_Error_ACPM();
	.line	17
	CALL	_reset_Error_ACPM
*** 122	-----------------------    init_pdpint();
	.line	18
	CALL	_init_pdpint
*** 123	-----------------------    init_pwm();
	.line	19
	CALL	_init_pwm
*** 124	-----------------------    init_encoder();
	.line	20
	CALL	_init_encoder
*** 125	-----------------------    init_adc();
	.line	21
	CALL	_init_adc
*** 126	-----------------------    loadsatvals();
	.line	22
	CALL	_loadsatvals
*** 127	-----------------------    init_reg_id();
	.line	23
	CALL	_init_reg_id
*** 128	-----------------------    init_reg_pos();
	.line	24
	CALL	_init_reg_pos
*** 129	-----------------------    init_reg_omg();
	.line	25
	CALL	_init_reg_omg
*** 130	-----------------------    init_reg_iq();
	.line	26
	CALL	_init_reg_iq
*** 131	-----------------------    init_field_pos();
	.line	27
	CALL	_init_field_pos
*** 132	-----------------------    init_reference();
	.line	28
	CALL	_init_reference
*** 133	-----------------------    init_logger();
	.line	29
	CALL	_init_logger
*** 134	-----------------------    start_pwm();
	.line	30
	CALL	_start_pwm
*** 136	-----------------------    get_ia_ib_offsets();
	.line	32
	CALL	_get_ia_ib_offsets
*** 138	-----------------------    new_pos = 0;
	.line	34
	LACK	0
	LDPK	_new_pos
	SACL	_new_pos
*** 139	-----------------------    old_pos = 0;
	.line	35
	SACL	_old_pos
*** 140	-----------------------    position = 0u;
	.line	36
	LDPK	_position
	SACL	_position
*** 141	-----------------------    omg_ref = 0;
	.line	37
	LDPK	_omg_ref
	SACL	_omg_ref
*** 142	-----------------------    i_q_ref = 0;
	.line	38
	LDPK	_i_q_ref
	SACL	_i_q_ref
*** 143	-----------------------    i_d_ref = 4309;
	.line	39
	LDPK	_i_d_ref
	SPLK	#4309,_i_d_ref
*** 145	-----------------------    start_encoder();
	.line	41
	CALL	_start_encoder
*** 147	-----------------------    InitializeKernel();
	.line	43
	CALL	_InitializeKernel
L8:
***	-----------------------g8:
*** 151	-----------------------    goto g8;
	.line	47
	B	L8
	.endfunc	154,000000000H,1

	.sym	_old_pos,_old_pos,4,2,16
	.globl	_old_pos

	.sym	_stop,_stop,4,2,16
	.globl	_stop

	.sym	_new_pos,_new_pos,4,2,16
	.globl	_new_pos
*****************************************************
* UNDEFINED REFERENCES                              *
*****************************************************
	.global	_reference
	.global	_pi_reg_pos
	.global	I$$SAVE
	.global	I$$REST
	.global	_pi_reg_omg
	.global	_get_adc_pair1
	.global	_pi_reg_id
	.global	_pi_reg_iq
	.global	_update_field_pos
	.global	_Init_SCSR_WS
	.global	_init_reg_id
	.global	_init_reg_pos
	.global	_init_reg_omg
	.global	_init_reg_iq
	.end

⌨️ 快捷键说明

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