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

📄 motorctrl.lst

📁 This isThe program of AVR microchip controling motor using PWM and PID.
💻 LST
📖 第 1 页 / 共 5 页
字号:
GAS LISTING C:\DOCUME~1\pstang\LOCALS~1\Temp/cciGaaaa.s 			page 1


   1               		.file	"motorctrl.c"
   2               		.arch atmega16
   3               	__SREG__ = 0x3f
   4               	__SP_H__ = 0x3e
   5               	__SP_L__ = 0x3d
   6               	__tmp_reg__ = 0
   7               	__zero_reg__ = 1
   8               		.global __do_copy_data
   9               		.global __do_clear_bss
  10               		.stabs	"C:\\Code\\AVR\\motorctrl/",100,0,0,.Ltext0
  11               		.stabs	"motorctrl.c",100,0,0,.Ltext0
  12               		.text
  13               	.Ltext0:
  14               		.stabs	"gcc2_compiled.",60,0,0,0
  15               		.stabs	"int:t(0,1)=r(0,1);-32768;32767;",128,0,0,0
  16               		.stabs	"char:t(0,2)=r(0,2);0;127;",128,0,0,0
  17               		.stabs	"long int:t(0,3)=@s32;r(0,3);0020000000000;0017777777777;",128,0,0,0
  18               		.stabs	"unsigned int:t(0,4)=r(0,4);0000000000000;0000000177777;",128,0,0,0
  19               		.stabs	"long unsigned int:t(0,5)=@s32;r(0,5);0000000000000;0037777777777;",128,0,0,0
  20               		.stabs	"long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;",128,0,0,
  21               		.stabs	"long long unsigned int:t(0,7)=@s64;r(0,7);0000000000000;01777777777777777777777;",128,0,0,
  22               		.stabs	"short int:t(0,8)=r(0,8);-32768;32767;",128,0,0,0
  23               		.stabs	"short unsigned int:t(0,9)=r(0,9);0000000000000;0000000177777;",128,0,0,0
  24               		.stabs	"signed char:t(0,10)=@s8;r(0,10);-128;127;",128,0,0,0
  25               		.stabs	"unsigned char:t(0,11)=@s8;r(0,11);0;255;",128,0,0,0
  26               		.stabs	"float:t(0,12)=r(0,1);4;0;",128,0,0,0
  27               		.stabs	"double:t(0,13)=r(0,1);4;0;",128,0,0,0
  28               		.stabs	"long double:t(0,14)=r(0,1);4;0;",128,0,0,0
  29               		.stabs	"complex int:t(0,15)=s4real:(0,1),0,16;imag:(0,1),16,16;;",128,0,0,0
  30               		.stabs	"complex float:t(0,16)=R3;8;0;",128,0,0,0
  31               		.stabs	"complex double:t(0,17)=R3;8;0;",128,0,0,0
  32               		.stabs	"complex long double:t(0,18)=R3;8;0;",128,0,0,0
  33               		.stabs	"__builtin_va_list:t(0,19)=*(0,20)=(0,20)",128,0,0,0
  34               		.stabs	"_Bool:t(0,21)=@s8;-16;",128,0,0,0
  35               		.stabs	"motorctrl.c",130,0,0,0
  36               		.stabs	"c:/programa/winavr/avr/include/avr/io.h",130,0,0,0
  37               		.stabs	"c:/programa/winavr/avr/include/avr/sfr_defs.h",130,0,0,0
  38               		.stabn	162,0,0,0
  39               		.stabs	"c:/programa/winavr/avr/include/avr/iom16.h",130,0,0,0
  40               		.stabn	162,0,0,0
  41               		.stabn	162,0,0,0
  42               		.stabs	"c:/programa/winavr/avr/include/avr/signal.h",130,0,0,0
  43               		.stabn	162,0,0,0
  44               		.stabs	"c:/programa/winavr/avr/include/avr/interrupt.h",130,0,0,0
  45               		.stabn	162,0,0,0
  46               		.stabs	"global.h",130,0,0,0
  47               		.stabs	"c:/code/avr/avrlib/avrlibdefs.h",130,0,0,0
  48               		.stabn	162,0,0,0
  49               		.stabs	"c:/code/avr/avrlib/avrlibtypes.h",130,0,0,0
  50               		.stabs	"u08:t(9,1)=(0,11)",128,0,32,0
  51               		.stabs	"s08:t(9,2)=(0,10)",128,0,33,0
  52               		.stabs	"u16:t(9,3)=(0,9)",128,0,34,0
  53               		.stabs	"s16:t(9,4)=(0,8)",128,0,35,0
  54               		.stabs	"u32:t(9,5)=(0,5)",128,0,36,0
  55               		.stabs	"s32:t(9,6)=(0,3)",128,0,37,0
  56               		.stabs	"u64:t(9,7)=(0,7)",128,0,38,0
  57               		.stabs	"s64:t(9,8)=(0,6)",128,0,39,0
GAS LISTING C:\DOCUME~1\pstang\LOCALS~1\Temp/cciGaaaa.s 			page 2


  58               		.stabs	"BOOL:t(9,9)=(0,11)",128,0,58,0
  59               		.stabs	"BYTE:t(9,10)=(0,11)",128,0,59,0
  60               		.stabs	"WORD:t(9,11)=(0,4)",128,0,60,0
  61               		.stabs	"DWORD:t(9,12)=(0,5)",128,0,61,0
  62               		.stabs	"UCHAR:t(9,13)=(0,11)",128,0,63,0
  63               		.stabs	"UINT:t(9,14)=(0,4)",128,0,64,0
  64               		.stabs	"USHORT:t(9,15)=(0,9)",128,0,65,0
  65               		.stabs	"ULONG:t(9,16)=(0,5)",128,0,66,0
  66               		.stabs	"CHAR:t(9,17)=(0,2)",128,0,68,0
  67               		.stabs	"INT:t(9,18)=(0,1)",128,0,69,0
  68               		.stabs	"LONG:t(9,19)=(0,3)",128,0,70,0
  69               		.stabn	162,0,0,0
  70               		.stabn	162,0,0,0
  71               		.stabs	"c:/code/avr/avrlib/uart.h",130,0,0,0
  72               		.stabs	"c:/code/avr/avrlib/buffer.h",130,0,0,0
  73               		.stabs	"struct_cBuffer:T(11,1)=s8dataptr:(11,2)=*(0,11),0,16;size:(0,9),16,16;datalength:(0,9),32,
  74               		.stabs	"cBuffer:t(11,3)=(11,1)",128,0,30,0
  75               		.stabn	162,0,0,0
  76               		.stabn	162,0,0,0
  77               		.stabs	"c:/code/avr/avrlib/rprintf.h",130,0,0,0
  78               		.stabs	"c:/programa/winavr/avr/include/avr/pgmspace.h",130,0,0,0
  79               		.stabs	"c:/programa/winavr/lib/gcc-lib/avr/3.3/include/stddef.h",130,0,0,0
  80               		.stabs	"size_t:t(14,1)=(0,4)",128,0,213,0
  81               		.stabn	162,0,0,0
  82               		.stabs	"prog_void:t(13,1)=(13,2)=(13,2)",128,0,81,0
  83               		.stabs	"prog_char:t(13,3)=(13,4)=@s8;r(13,4);-128;127;",128,0,82,0
  84               		.stabs	"prog_uchar:t(13,5)=(13,6)=@s8;r(13,6);0;255;",128,0,83,0
  85               		.stabs	"prog_int:t(13,7)=(13,8)=r(13,8);-32768;32767;",128,0,84,0
  86               		.stabs	"prog_long:t(13,9)=(13,10)=@s32;r(13,10);0020000000000;0017777777777;",128,0,85,0
  87               		.stabs	"prog_long_long:t(13,11)=(13,12)=@s64;r(13,12);01000000000000000000000;07777777777777777777
  88               		.stabn	162,0,0,0
  89               		.stabs	"c:/code/avr/avrlib/rprintfconf.h",130,0,0,0
  90               		.stabn	162,0,0,0
  91               		.stabn	162,0,0,0
  92               		.stabs	"c:/code/avr/avrlib/timer.h",130,0,0,0
  93               		.stabn	162,0,0,0
  94               		.stabs	"c:/code/avr/avrlib/vt100.h",130,0,0,0
  95               		.stabn	162,0,0,0
  96               		.stabs	"c:/code/avr/avrlib/a2d.h",130,0,0,0
  97               		.stabn	162,0,0,0
  98               		.stabs	"c:/code/avr/avrlib/encoder.h",130,0,0,0
  99               		.stabs	"encoderconf.h",130,0,0,0
 100               		.stabn	162,0,0,0
 101               		.stabs	"struct_EncoderState:T(19,1)=s4position:(9,6),0,32;;",128,0,0,0
 102               		.stabs	"EncoderStateType:t(19,2)=(19,1)",128,0,101,0
 103               		.stabn	162,0,0,0
 104               		.stabs	"c:/code/avr/avrlib/fixedpt.h",130,0,0,0
 105               		.stabn	162,0,0,0
 106               		.stabs	"c:/code/avr/avrlib/cmdline.h",130,0,0,0
 107               		.stabs	"CmdlineFuncPtrType:t(22,1)=(22,2)=*(22,3)=f(0,20)",128,0,72,0
 108               		.stabn	162,0,0,0
 109               	.global	EncoderLastPos
 110               	.global	EncoderLastPos
 111               		.section .bss
 112               		.type	EncoderLastPos, @object
 113               		.size	EncoderLastPos, 4
 114               	EncoderLastPos:
GAS LISTING C:\DOCUME~1\pstang\LOCALS~1\Temp/cciGaaaa.s 			page 3


 115 0000 0000 0000 		.skip 4,0
 116               	.global	Counts
 117               	.global	Counts
 118               		.type	Counts, @object
 119               		.size	Counts, 4
 120               	Counts:
 121 0004 0000 0000 		.skip 4,0
 122               	.global	Cycles
 123               	.global	Cycles
 124               		.type	Cycles, @object
 125               		.size	Cycles, 4
 126               	Cycles:
 127 0008 0000 0000 		.skip 4,0
 128               	.global	TimerIncs
 129               	.global	TimerIncs
 130               		.type	TimerIncs, @object
 131               		.size	TimerIncs, 1
 132               	TimerIncs:
 133 000c 00        		.skip 1,0
 134               	.global	ServiceFlag
 135               	.global	ServiceFlag
 136               		.type	ServiceFlag, @object
 137               		.size	ServiceFlag, 1
 138               	ServiceFlag:
 139 000d 00        		.skip 1,0
 140               		.stabs	"Controller_struct:T(1,1)=s53Kp:(9,6),0,32;Ki:(9,6),32,32;Kd:(9,6),64,32;error:(9,6),96,32;
 141               		.text
 142               		.stabs	"main:F(0,1)",36,0,105,main
 143               	.global	main
 144               		.type	main, @function
 145               	main:
   1:motorctrl.c   **** //*****************************************************************************
   2:motorctrl.c   **** // File Name	: pid.c
   3:motorctrl.c   **** // 
   4:motorctrl.c   **** // Title		: test pid implementation
   5:motorctrl.c   **** // Revision		: 1.1
   6:motorctrl.c   **** // Notes		:
   7:motorctrl.c   **** // Target MCU	: Atmel AVR series
   8:motorctrl.c   **** // Editor Tabs	: 4
   9:motorctrl.c   **** // 
  10:motorctrl.c   **** // Revision History:
  11:motorctrl.c   **** // When			Who			Description of change
  12:motorctrl.c   **** // -----------	-----------	-----------------------
  13:motorctrl.c   **** // 05-Feb-2003	pstang		Created the program
  14:motorctrl.c   **** //*****************************************************************************
  15:motorctrl.c   **** 
  16:motorctrl.c   ****  
  17:motorctrl.c   **** //----- Include Files ---------------------------------------------------------
  18:motorctrl.c   **** #include <avr/io.h>		// include I/O definitions (port names, pin names, etc)
  19:motorctrl.c   **** #include <avr/signal.h>	// include "signal" names (interrupt names)
  20:motorctrl.c   **** #include <avr/interrupt.h>	// include interrupt support
  21:motorctrl.c   **** 
  22:motorctrl.c   **** #include "global.h"		// include our global settings
  23:motorctrl.c   **** #include "uart.h"		// include uart function library
  24:motorctrl.c   **** #include "rprintf.h"	// include printf function library
  25:motorctrl.c   **** #include "timer.h"		// include timer function library (timing, PWM, etc)
  26:motorctrl.c   **** #include "vt100.h"		// include VT100 terminal support
GAS LISTING C:\DOCUME~1\pstang\LOCALS~1\Temp/cciGaaaa.s 			page 4


  27:motorctrl.c   **** #include "a2d.h"		// include A2D converter support
  28:motorctrl.c   **** #include "encoder.h"	// include encoder driver
  29:motorctrl.c   **** #include "fixedpt.h"	// fixed-point math support
  30:motorctrl.c   **** #include "cmdline.h"
  31:motorctrl.c   **** 
  32:motorctrl.c   **** // motor connection defines
  33:motorctrl.c   **** #define MOTOR_BRAKE_PORT	PORTC
  34:motorctrl.c   **** #define MOTOR_BRAKE_DDR		DDRC
  35:motorctrl.c   **** #define MOTOR0_BRAKE		PC2
  36:motorctrl.c   **** #define MOTOR1_BRAKE		PC3
  37:motorctrl.c   **** 
  38:motorctrl.c   **** #define MOTOR_PWM_PORT		PORTD
  39:motorctrl.c   **** #define MOTOR_PWM_DDR		DDRD
  40:motorctrl.c   **** #define MOTOR0_PWM			PD4
  41:motorctrl.c   **** #define MOTOR1_PWM			PD5
  42:motorctrl.c   **** 
  43:motorctrl.c   **** #define MOTOR_DIR_PORT		PORTD
  44:motorctrl.c   **** #define MOTOR_DIR_DDR		DDRD
  45:motorctrl.c   **** #define MOTOR0_DIR			PD6
  46:motorctrl.c   **** #define MOTOR1_DIR			PD7
  47:motorctrl.c   **** 
  48:motorctrl.c   **** // motor controller mode defines
  49:motorctrl.c   **** #define CONTROLMODE_POS		0
  50:motorctrl.c   **** #define CONTROLMODE_VEL		1
  51:motorctrl.c   **** 
  52:motorctrl.c   **** volatile s32 EncoderLastPos=0;
  53:motorctrl.c   **** volatile u32 Counts=0;
  54:motorctrl.c   **** volatile u32 Cycles=0;
  55:motorctrl.c   **** volatile u08 TimerIncs=0;
  56:motorctrl.c   **** volatile u08 ServiceFlag=FALSE;
  57:motorctrl.c   **** volatile struct Controller_struct
  58:motorctrl.c   **** {
  59:motorctrl.c   **** 	// controls coefficients
  60:motorctrl.c   **** 	s32 Kp;				// proportional gain
  61:motorctrl.c   **** 	s32 Ki;				// integral gain
  62:motorctrl.c   **** 	s32 Kd;				// derivative gain
  63:motorctrl.c   **** 	// state variables
  64:motorctrl.c   **** 	s32 error;			// error (input-feedback)
  65:motorctrl.c   **** 	s32 error_last;		// previous error
  66:motorctrl.c   **** 	s32 error_integ;	// integral of error
  67:motorctrl.c   **** 	s32 error_diff;		// derivative of error
  68:motorctrl.c   **** 	// limits
  69:motorctrl.c   **** 	s32 windupMax;		// integral wind-up limit
  70:motorctrl.c   **** 	s32 outputMax;		// motor output clamp (limit)
  71:motorctrl.c   **** 	// input and output
  72:motorctrl.c   **** 	s32 output;			// motor output
  73:motorctrl.c   **** 	s32 input;			// user input
  74:motorctrl.c   **** 	s32 feedback;		// motor feedback
  75:motorctrl.c   **** 	// counters
  76:motorctrl.c   **** 	u32 counts;
  77:motorctrl.c   **** 	// mode
  78:motorctrl.c   **** 	u08 mode;			// control mode
  79:motorctrl.c   **** } Controller;
  80:motorctrl.c   **** 
  81:motorctrl.c   **** // motor command system
  82:motorctrl.c   **** void motorCommand(void);
  83:motorctrl.c   **** // motor command functions
GAS LISTING C:\DOCUME~1\pstang\LOCALS~1\Temp/cciGaaaa.s 			page 5


  84:motorctrl.c   **** void motorPosGo(void);
  85:motorctrl.c   **** void motorGetCoeffs(void);
  86:motorctrl.c   **** void motorSetCoeffs(void);
  87:motorctrl.c   **** void motorSetMode(void);
  88:motorctrl.c   **** void motorShowPID(void);
  89:motorctrl.c   **** void motorHelp(void);
  90:motorctrl.c   **** 
  91:motorctrl.c   **** // motor control functions
  92:motorctrl.c   **** void motorInit(void);
  93:motorctrl.c   **** void motorSetPower(s32 power);
  94:motorctrl.c   **** 
  95:motorctrl.c   **** // PID controller algorithm
  96:motorctrl.c   **** void pidService(void);
  97:motorctrl.c   **** void timerService(void);
  98:motorctrl.c   **** 
  99:motorctrl.c   **** // testing functions
 100:motorctrl.c   **** void motorTest(void);
 101:motorctrl.c   **** void encoderTest(void);
 102:motorctrl.c   **** 
 103:motorctrl.c   **** //----- Begin Code ------------------------------------------------------------
 104:motorctrl.c   **** int main(void)
 105:motorctrl.c   **** {
 146               		.stabn 68,0,105,.LM1-main
 147               	.LM1:
 148               	/* prologue: frame size=0 */
 149 0000 C0E0      		ldi r28,lo8(__stack - 0)
 150 0002 D0E0      		ldi r29,hi8(__stack - 0)
 151 0004 DEBF      		out __SP_H__,r29
 152 0006 CDBF      		out __SP_L__,r28
 153               	/* prologue end (size=4) */
 106:motorctrl.c   **** 	// initialize our libraries
 107:motorctrl.c   **** 	// initialize the UART (serial port)
 108:motorctrl.c   **** 	uartInit();
 154               		.stabn 68,0,108,.LM2-main
 155               	.LM2:
 156 0008 0E94 0000 		call uartInit
 109:motorctrl.c   **** 	// set the baud rate of the UART for our debug/reporting output
 110:motorctrl.c   **** 	uartSetBaudRate(115200);
 157               		.stabn 68,0,110,.LM3-main
 158               	.LM3:
 159 000c 60E0      		ldi r22,lo8(115200)
 160 000e 72EC      		ldi r23,hi8(115200)
 161 0010 81E0      		ldi r24,hlo8(115200)
 162 0012 90E0      		ldi r25,hhi8(115200)
 163 0014 0E94 0000 		call uartSetBaudRate
 111:motorctrl.c   **** 	// initialize the timer system
 112:motorctrl.c   **** 	timerInit();
 164               		.stabn 68,0,112,.LM4-main
 165               	.LM4:
 166 0018 0E94 0000 		call timerInit
 113:motorctrl.c   **** 	// init A2D
 114:motorctrl.c   **** 	a2dInit();
 167               		.stabn 68,0,114,.LM5-main
 168               	.LM5:
 169 001c 0E94 0000 		call a2dInit
 115:motorctrl.c   **** 	// initialize rprintf system
 116:motorctrl.c   **** 	rprintfInit(uartSendByte);
GAS LISTING C:\DOCUME~1\pstang\LOCALS~1\Temp/cciGaaaa.s 			page 6

⌨️ 快捷键说明

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