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

📄 iotxd.lst

📁 模拟串口的通讯程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
   1               		.file	"iotxd.c"
   2               		.arch atmega128
   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
  12               		.text
  13               	.Ltext0:
  60               	.global	delay_ms
  62               	delay_ms:
   1:iotxd.c       **** #include <avr/io.h>
   2:iotxd.c       **** #include <avr/delay.h>
   3:iotxd.c       **** #define TXD_H sbi(PORTE,6)
   4:iotxd.c       **** #define TXD_L cbi(PORTE,6)
   5:iotxd.c       **** #define TXD   sbi(DDRE,6)
   6:iotxd.c       **** void delay_ms(uint16_t ms) 
   7:iotxd.c       **** { 
  64               	.LM1:
  65               	/* prologue: frame size=4 */
  66 0000 CF93      		push r28
  67 0002 DF93      		push r29
  68 0004 CDB7      		in r28,__SP_L__
  69 0006 DEB7      		in r29,__SP_H__
  70 0008 2497      		sbiw r28,4
  71 000a 0FB6      		in __tmp_reg__,__SREG__
  72 000c F894      		cli
  73 000e DEBF      		out __SP_H__,r29
  74 0010 0FBE      		out __SREG__,__tmp_reg__
  75 0012 CDBF      		out __SP_L__,r28
  76               	/* prologue end (size=10) */
  77 0014 8983      		std Y+1,r24
  78 0016 9A83      		std Y+2,r25
   8:iotxd.c       ****    uint16_t  i;   
   9:iotxd.c       ****    for(i=0;i<ms;i++ ) 
  80               	.LM2:
  81               	.LBB2:
  82 0018 1B82      		std Y+3,__zero_reg__
  83 001a 1C82      		std Y+4,__zero_reg__
  84               	.L4:
  85 001c 2B81      		ldd r18,Y+3
  86 001e 3C81      		ldd r19,Y+4
  87 0020 8981      		ldd r24,Y+1
  88 0022 9A81      		ldd r25,Y+2
  89 0024 2817      		cp r18,r24
  90 0026 3907      		cpc r19,r25
  91 0028 08F0      		brlo .L7
  92 002a 0AC0      		rjmp .L3
  93               	.L7:
  10:iotxd.c       ****     { 
  11:iotxd.c       ****       _delay_loop_2((uint16_t)(250*14.7456));   //16-bit count, 4 cycles/loop  
  95               	.LM3:
  96 002c 86E6      		ldi r24,lo8(3686)
  97 002e 9EE0      		ldi r25,hi8(3686)
  98 0030 0E94 0000 		call _delay_loop_2
 100               	.LM4:
 101 0034 8B81      		ldd r24,Y+3
 102 0036 9C81      		ldd r25,Y+4
 103 0038 0196      		adiw r24,1
 104 003a 8B83      		std Y+3,r24
 105 003c 9C83      		std Y+4,r25
 106 003e EECF      		rjmp .L4
  12:iotxd.c       ****     }                                               //8MHz/8000=1ms 8000/4=2000=1ms    
  13:iotxd.c       **** }
 108               	.LM5:
 109               	.L3:
 110               	.LBE2:
 111               	/* epilogue: frame size=4 */
 112 0040 2496      		adiw r28,4
 113 0042 0FB6      		in __tmp_reg__,__SREG__
 114 0044 F894      		cli
 115 0046 DEBF      		out __SP_H__,r29
 116 0048 0FBE      		out __SREG__,__tmp_reg__
 117 004a CDBF      		out __SP_L__,r28
 118 004c DF91      		pop r29
 119 004e CF91      		pop r28
 120 0050 0895      		ret
 121               	/* epilogue end (size=9) */
 122               	/* function delay_ms size 41 (22) */
 127               	.Lscope0:
 131               	.global	io_uart_TXD
 133               	io_uart_TXD:
  14:iotxd.c       **** void io_uart_TXD(uint8_t data)
  15:iotxd.c       **** {
 135               	.LM6:
 136               	/* prologue: frame size=2 */
 137 0052 CF93      		push r28
 138 0054 DF93      		push r29
 139 0056 CDB7      		in r28,__SP_L__
 140 0058 DEB7      		in r29,__SP_H__
 141 005a 2297      		sbiw r28,2
 142 005c 0FB6      		in __tmp_reg__,__SREG__
 143 005e F894      		cli
 144 0060 DEBF      		out __SP_H__,r29
 145 0062 0FBE      		out __SREG__,__tmp_reg__
 146 0064 CDBF      		out __SP_L__,r28
 147               	/* prologue end (size=10) */
 148 0066 8983      		std Y+1,r24
  16:iotxd.c       **** 	uint8_t i=0;
 150               	.LM7:
 151               	.LBB3:
 152 0068 1A82      		std Y+2,__zero_reg__
  17:iotxd.c       **** 	//TXD;
  18:iotxd.c       **** 	TXD_L;
 154               	.LM8:
 155 006a 8091 2300 		lds r24,35
 156 006e 8F7B      		andi r24,lo8(-65)
 157 0070 8093 2300 		sts 35,r24
  19:iotxd.c       **** 	_delay_loop_2(371);
 159               	.LM9:
 160 0074 83E7      		ldi r24,lo8(371)
 161 0076 91E0      		ldi r25,hi8(371)
 162 0078 0E94 0000 		call _delay_loop_2
  20:iotxd.c       **** 	for(i=0;i<8;i++)
 164               	.LM10:
 165 007c 1A82      		std Y+2,__zero_reg__
 166               	.L9:
 167 007e 8A81      		ldd r24,Y+2
 168 0080 8830      		cpi r24,lo8(8)
 169 0082 08F0      		brlo .L12
 170 0084 1CC0      		rjmp .L10
 171               	.L12:
  21:iotxd.c       **** 	{
  22:iotxd.c       **** 		if(data&0x01)
 173               	.LM11:
 174 0086 8981      		ldd r24,Y+1
 175 0088 9927      		clr r25
 176 008a 8170      		andi r24,lo8(1)
 177 008c 9070      		andi r25,hi8(1)
 178 008e 0097      		sbiw r24,0
 179 0090 31F0      		breq .L13
  23:iotxd.c       **** 			TXD_H;
 181               	.LM12:
 182 0092 8091 2300 		lds r24,35
 183 0096 8064      		ori r24,lo8(64)
 184 0098 8093 2300 		sts 35,r24
 185 009c 05C0      		rjmp .L14
 186               	.L13:
  24:iotxd.c       **** 		else
  25:iotxd.c       **** 			TXD_L;
 188               	.LM13:
 189 009e 8091 2300 		lds r24,35
 190 00a2 8F7B      		andi r24,lo8(-65)
 191 00a4 8093 2300 		sts 35,r24
 192               	.L14:
  26:iotxd.c       **** 		_delay_loop_2(371);
 194               	.LM14:
 195 00a8 83E7      		ldi r24,lo8(371)
 196 00aa 91E0      		ldi r25,hi8(371)
 197 00ac 0E94 0000 		call _delay_loop_2
  27:iotxd.c       **** 		data=data>>1;
 199               	.LM15:
 200 00b0 8981      		ldd r24,Y+1
 201 00b2 8695      		lsr r24
 202 00b4 8983      		std Y+1,r24
 204               	.LM16:
 205 00b6 8A81      		ldd r24,Y+2
 206 00b8 8F5F      		subi r24,lo8(-(1))
 207 00ba 8A83      		std Y+2,r24
 208 00bc E0CF      		rjmp .L9
 209               	.L10:
  28:iotxd.c       **** 	}
  29:iotxd.c       **** 	TXD_H;
 211               	.LM17:
 212 00be 8091 2300 		lds r24,35
 213 00c2 8064      		ori r24,lo8(64)
 214 00c4 8093 2300 		sts 35,r24
  30:iotxd.c       **** 	_delay_loop_2(371);
 216               	.LM18:
 217 00c8 83E7      		ldi r24,lo8(371)
 218 00ca 91E0      		ldi r25,hi8(371)
 219 00cc 0E94 0000 		call _delay_loop_2
  31:iotxd.c       **** }
 221               	.LM19:
 222               	.LBE3:
 223               	/* epilogue: frame size=2 */
 224 00d0 2296      		adiw r28,2
 225 00d2 0FB6      		in __tmp_reg__,__SREG__
 226 00d4 F894      		cli
 227 00d6 DEBF      		out __SP_H__,r29
 228 00d8 0FBE      		out __SREG__,__tmp_reg__
 229 00da CDBF      		out __SP_L__,r28
 230 00dc DF91      		pop r29
 231 00de CF91      		pop r28
 232 00e0 0895      		ret
 233               	/* epilogue end (size=9) */
 234               	/* function io_uart_TXD size 72 (53) */
 239               	.Lscope1:
 242               	.global	main
 244               	main:
  32:iotxd.c       **** int main(void)
  33:iotxd.c       **** {
 246               	.LM20:
 247               	/* prologue: frame size=5 */
 248 00e2 C0E0      		ldi r28,lo8(__stack - 5)
 249 00e4 D0E0      		ldi r29,hi8(__stack - 5)
 250 00e6 DEBF      		out __SP_H__,r29
 251 00e8 CDBF      		out __SP_L__,r28
 252               	/* prologue end (size=4) */
  34:iotxd.c       **** 	uint8_t i;
  35:iotxd.c       **** 	uint16_t TIME_COUNT;
  36:iotxd.c       **** 	uint8_t time_high,time_low;
  37:iotxd.c       **** 	TXD;
 254               	.LM21:
 255               	.LBB4:
 256 00ea 8091 2200 		lds r24,34
 257 00ee 8064      		ori r24,lo8(64)
 258 00f0 8093 2200 		sts 34,r24
  38:iotxd.c       **** 	TXD_H;
 260               	.LM22:
 261 00f4 8091 2300 		lds r24,35
 262 00f8 8064      		ori r24,lo8(64)
 263 00fa 8093 2300 		sts 35,r24
  39:iotxd.c       **** 	/*delay_ms(3000);
  40:iotxd.c       **** 	
  41:iotxd.c       **** 	//变量定义
  42:iotxd.c       **** //选择快速PWM模式
  43:iotxd.c       **** 	TCCR1B|=(1<<WGM12)|(1<<WGM13);
  44:iotxd.c       **** 	TCCR1A|=3<<WGM10;
  45:iotxd.c       **** 
  46:iotxd.c       **** 	//预分频1
  47:iotxd.c       **** 	TCCR1B&=0xF8;//11111 000
  48:iotxd.c       **** 	TCCR1B|=0x01;//00000 011
  49:iotxd.c       **** 	OCR1A=0xfff0;
  50:iotxd.c       **** 	//OCR1A=0x2880;
  51:iotxd.c       **** 	_delay_loop_2(371);
  52:iotxd.c       **** 	//将预分频置0,终止定时器
  53:iotxd.c       **** 	TCCR1B&=0xF8;//1111 1000
  54:iotxd.c       **** 	TIME_COUNT=TCNT1;
  55:iotxd.c       **** 	time_high=TIME_COUNT/256;
  56:iotxd.c       **** 	time_low=TIME_COUNT%256;
  57:iotxd.c       **** 	//while(1);
  58:iotxd.c       **** 	delay_ms(1000);
  59:iotxd.c       **** 	io_uart_TXD(0x53);
  60:iotxd.c       **** 	delay_ms(1000);
  61:iotxd.c       **** 	io_uart_TXD(0x54);
  62:iotxd.c       **** 	delay_ms(1000);
  63:iotxd.c       **** 	io_uart_TXD(0x55);
  64:iotxd.c       **** 	delay_ms(1000);
  65:iotxd.c       **** 	io_uart_TXD(time_high);
  66:iotxd.c       **** 	delay_ms(1000);
  67:iotxd.c       **** 	io_uart_TXD(time_low);
  68:iotxd.c       **** 	delay_ms(1000);*/
  69:iotxd.c       **** 	io_uart_TXD(0x51);

⌨️ 快捷键说明

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