📄 128l_usart.lst
字号:
__start:
__text_start:
007C EFCF LDI R28,0xFF
007D E1D0 LDI R29,0x10
007E BFCD OUT 0x3D,R28
007F BFDE OUT 0x3E,R29
0080 51C0 SUBI R28,0x10
0081 40D0 SBCI R29,0
0082 EA0A LDI R16,0xAA
0083 8308 STD Y+0,R16
0084 2400 CLR R0
0085 E6EB LDI R30,0x6B
0086 E0F1 LDI R31,1
0087 E011 LDI R17,1
0088 36EB CPI R30,0x6B
0089 07F1 CPC R31,R17
008A F011 BEQ 0x008D
008B 9201 ST R0,Z+
008C CFFB RJMP 0x0088
008D 8300 STD Z+0,R16
008E E8EC LDI R30,0x8C
008F E0F0 LDI R31,0
0090 E0A0 LDI R26,0
0091 E0B1 LDI R27,1
0092 E010 LDI R17,0
0093 3FE7 CPI R30,0xF7
0094 07F1 CPC R31,R17
0095 F021 BEQ 0x009A
0096 95C8 LPM
0097 9631 ADIW R30,1
0098 920D ST R0,X+
0099 CFF9 RJMP 0x0093
009A 940E009D CALL _main
_exit:
009C CFFF RJMP _exit
FILE: F:\我的BACK\淘宝\128开发板\程序\128L_USART1\main.c
(0001) /******************************************************************
(0002) // PROJECT:chipcon RF DEMO TX MODE
(0003) // RF: CC1100 or cc2500
(0004) // CC1100:433。92MHZ
(0005) // MCU: MEGA128L(Microchip)
(0006) // Designed : yu(Infortech)
(0007) // Date : 2007-11
(0008) // only transmit www.apd-china.com
(0009) ******************************************************************/
(0010)
(0011) #include "config.h"
(0012) #include "debug.h"
(0013)
(0014)
(0015) void main (void)
(0016) {
(0017) unsigned char i;
(0018)
(0019) init_devices();
_main:
i --> Y+1
009D 940E00F2 CALL _init_devices
(0020) debug0_Print("debug0_Initall_OK\r\n");
009F E507 LDI R16,0x57
00A0 E011 LDI R17,1
00A1 940E0162 CALL _debug0_Print
(0021) debug1_Print("debug1_Initall_OK\r\n");
00A3 E403 LDI R16,0x43
00A4 E011 LDI R17,1
00A5 940E0172 CALL _debug1_Print
00A7 C010 RJMP 0x00B8
(0022)
(0023) while(1)
(0024) {
(0025) debug0_Print("Now Enjoying the show!");//提示信息
00A8 E20C LDI R16,0x2C
00A9 E011 LDI R17,1
00AA 940E0162 CALL _debug0_Print
(0026) debug1_Print("Now Enjoying the show!");//提示信息
00AC E20C LDI R16,0x2C
00AD E011 LDI R17,1
00AE 940E0172 CALL _debug1_Print
(0027)
(0028) debug0_Print("debug0_Hello World:\r\n");
00B0 E106 LDI R16,0x16
00B1 E011 LDI R17,1
00B2 940E0162 CALL _debug0_Print
(0029) debug1_Print("debug1_Hello World:\r\n");
00B4 E000 LDI R16,0
00B5 E011 LDI R17,1
00B6 940E0172 CALL _debug1_Print
00B8 CFEF RJMP 0x00A8
00B9 9508 RET
FILE: F:\我的BACK\淘宝\128开发板\程序\128L_USART1\common.c
(0001)
(0002) #include <iom128v.h>
(0003) #include <macros.h>
(0004) #include "config.h"
(0005)
(0006) void port_init(void)
(0007) {
(0008) PORTA = 0x00;
_port_init:
00BA 2422 CLR R2
00BB BA2B OUT 0x1B,R2
(0009) DDRA = 0x00;
00BC BA2A OUT 0x1A,R2
(0010) PORTB = 0x80;
00BD E880 LDI R24,0x80
00BE BB88 OUT 0x18,R24
(0011) DDRB = 0x80;
00BF BB87 OUT 0x17,R24
(0012) PORTC = 0x00; //m103 output only
00C0 BA25 OUT 0x15,R2
(0013) DDRC = 0x00;
00C1 BA24 OUT 0x14,R2
(0014) PORTD = 0x00;
00C2 BA22 OUT 0x12,R2
(0015) DDRD = 0x00;
00C3 BA21 OUT 0x11,R2
(0016) PORTE = 0x00;
00C4 B823 OUT 0x03,R2
(0017) DDRE = 0x00;
00C5 B822 OUT 0x02,R2
(0018) PORTF = 0x00;
00C6 92200062 STS 0x62,R2
(0019) DDRF = 0x00;
00C8 92200061 STS 0x61,R2
(0020) PORTG = 0x00;
00CA 92200065 STS 0x65,R2
(0021) DDRG = 0x00;
00CC 92200064 STS 0x64,R2
00CE 9508 RET
(0022) }
(0023)
(0024) //SPI initialize
(0025) // clock rate: 1000000hz
(0026) void spi_init(void)
(0027) {
(0028) SPCR = 0x50; //setup SPI
_spi_init:
00CF E580 LDI R24,0x50
00D0 B98D OUT 0x0D,R24
(0029) SPSR = 0x00; //setup SPI
00D1 2422 CLR R2
00D2 B82E OUT 0x0E,R2
00D3 9508 RET
(0030) }
(0031) //1200 4M
(0032) void uart0_init(void)
(0033) {
(0034) UCSR0B = 0x00; //disable while setting baud rate
_uart0_init:
00D4 2422 CLR R2
00D5 B82A OUT 0x0A,R2
(0035) UCSR0A = 0x00;
00D6 B82B OUT 0x0B,R2
(0036) UCSR0C = 0x06;
00D7 E086 LDI R24,6
00D8 93800095 STS 0x95,R24
(0037) UBRR0L = 0xCF; //set baud rate lo
00DA EC8F LDI R24,0xCF
00DB B989 OUT 0x09,R24
(0038) UBRR0H = 0x00; //set baud rate hi
00DC 92200090 STS 0x90,R2
(0039) UCSR0B = 0x18;
00DE E188 LDI R24,0x18
00DF B98A OUT 0x0A,R24
00E0 9508 RET
(0040) }
(0041)
(0042) //UART1 initialize
(0043) // desired baud rate:2400
(0044) // actual baud rate:2404 (0.2%)
(0045) // char size: 8 bit
(0046) // parity: Disabled
(0047) void uart1_init(void)
(0048) {
(0049) UCSR1B = 0x00; //disable while setting baud rate
_uart1_init:
00E1 2422 CLR R2
00E2 9220009A STS 0x9A,R2
(0050) UCSR1A = 0x00;
00E4 9220009B STS 0x9B,R2
(0051) UCSR1C = 0x06;
00E6 E086 LDI R24,6
00E7 9380009D STS 0x9D,R24
(0052) UBRR1L = 0x67; //set baud rate lo
00E9 E687 LDI R24,0x67
00EA 93800099 STS 0x99,R24
(0053) UBRR1H = 0x00; //set baud rate hi
00EC 92200098 STS 0x98,R2
(0054) UCSR1B = 0x18;
00EE E188 LDI R24,0x18
00EF 9380009A STS 0x9A,R24
00F1 9508 RET
(0055) }
(0056)
(0057) //call this routine to initialize all peripherals
(0058) void init_devices(void)
(0059) {
(0060) //stop errant interrupts until set up
(0061) CLI(); //disable all interrupts
_init_devices:
00F2 94F8 BCLR 7
(0062) XDIV = 0x00; //xtal divider
00F3 2422 CLR R2
00F4 BE2C OUT 0x3C,R2
(0063) XMCRA = 0x00; //external memory
00F5 9220006D STS 0x6D,R2
(0064) port_init();
00F7 DFC2 RCALL _port_init
(0065) spi_init();
00F8 DFD6 RCALL _spi_init
(0066) uart0_init();
00F9 DFDA RCALL _uart0_init
(0067) uart1_init();
00FA DFE6 RCALL _uart1_init
(0068)
(0069) MCUCR = 0x00;
00FB 2422 CLR R2
00FC BE25 OUT 0x35,R2
(0070) EICRA = 0x00; //extended ext ints
00FD 9220006A STS 0x6A,R2
(0071) EICRB = 0x00; //extended ext ints
00FF BE2A OUT 0x3A,R2
(0072) EIMSK = 0x00;
0100 BE29 OUT 0x39,R2
(0073) TIMSK = 0x00; //timer interrupt sources
0101 BE27 OUT 0x37,R2
(0074) ETIMSK = 0x00; //extended timer interrupt sources
0102 9220007D STS 0x7D,R2
(0075) SEI(); //re-enable interrupts
0104 9478 BSET 7
0105 9508 RET
_delay:
i --> R20
j --> R22
t --> R16
0106 940E018B CALL push_gset2
(0076) //all peripherals are now initialized
(0077) }
(0078)
(0079)
(0080)
(0081)
(0082)
(0083) //*********************************************************************/
(0084) //*函数名:delay()
(0085) //*函数功能:延时函数
(0086) //*函数说明:无返回值 t为一个延时的时间
(0087) //*设计者: yu 日期:2007-10-20
(0088) //**********************************************************************/
(0089) void delay(int t)
(0090) {
(0091) int i,j ;
(0092) for(i=0;i<t;i++)
0108 2744 CLR R20
0109 2755 CLR R21
010A C00A RJMP 0x0115
(0093) for(j=0;j<t;j++);
010B 2766 CLR R22
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -