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

📄 leson2.lis

📁 rewtr y vruutuyukyuj
💻 LIS
📖 第 1 页 / 共 2 页
字号:
                        .module leson2.c
                        .area text(rom, con, rel)
 0000                   .dbfile F:\lesson\leson2.c
 0000                   .dbfunc e WDT_off _WDT_off fV
                        .even
 0000           _WDT_off::
 0000                   .dbline -1
 0000                   .dbline 12
 0000           ; #include  <io2313v.h>
 0000           ; #include  <macros.h>
 0000           ; #define  uint   unsigned int 
 0000           ; #define  uchar  unsigned char
 0000           ; //#define LED_SET     PORTD |= (1 << PD5)            //位置高
 0000           ; //#define LED_CLR     PORTD &= ~(1 << PD5)           //位置低
 0000           ; //#define LED_COM     PORTD ^= (1 << PD5)            //位取反
 0000           ; //#define LED_R       PIND & (1 << PD5)              //位读取
 0000           ; 
 0000           ; 
 0000           ; void WDT_off(void)
 0000           ; {
 0000                   .dbline 16
 0000           ; //__disable_interrupt();
 0000           ; //__watchdog_reset();
 0000           ; //#asm("cli");
 0000           ; SREG &= ~(1 << (SREG&0x80));
 0000 1FB7              in R17,0x3f
 0002 1078              andi R17,128
 0004 01E0              ldi R16,1
 0006 00D0              rcall lsl8
 0008 202E              mov R2,R16
 000A 2094              com R2
 000C 3FB6              in R3,0x3f
 000E 3220              and R3,R2
 0010 3FBE              out 0x3f,R3
 0012                   .dbline 18
 0012           ; // Clear WDRF in MCUSR 
 0012           ; MCUSR &= ~(1<<(MCUSR&0x08));
 0012 14B7              in R17,0x34
 0014 1870              andi R17,8
 0016 01E0              ldi R16,1
 0018 00D0              rcall lsl8
 001A 202E              mov R2,R16
 001C 2094              com R2
 001E 34B6              in R3,0x34
 0020 3220              and R3,R2
 0022 34BE              out 0x34,R3
 0024                   .dbline 21
 0024           ; // Write logical one to WDCE and WDE
 0024           ; // Keep old prescaler setting to prevent unintentional time-out
 0024           ; WDTCSR |= (1<<(WDTCSR&0x10)) | (1<<(WDTCSR&0x08));
 0024 11B5              in R17,0x21
 0026 1870              andi R17,8
 0028 01E0              ldi R16,1
 002A 00D0              rcall lsl8
 002C 202E              mov R2,R16
 002E 11B5              in R17,0x21
 0030 1071              andi R17,16
 0032 01E0              ldi R16,1
 0034 00D0              rcall lsl8
 0036 302E              mov R3,R16
 0038 3228              or R3,R2
 003A 21B4              in R2,0x21
 003C 2328              or R2,R3
 003E 21BC              out 0x21,R2
 0040                   .dbline 23
 0040           ; // Turn off WDT 
 0040           ; WDTCSR = 0x00;
 0040 2224              clr R2
 0042 21BC              out 0x21,R2
 0044                   .dbline 24
 0044           ; SREG |= (1 << (SREG&0x80));
 0044 1FB7              in R17,0x3f
 0046 1078              andi R17,128
 0048 01E0              ldi R16,1
 004A 00D0              rcall lsl8
 004C 2FB6              in R2,0x3f
 004E 202A              or R2,R16
 0050 2FBE              out 0x3f,R2
 0052                   .dbline -2
 0052           L1:
 0052                   .dbline 0 ; func end
 0052 0895              ret
 0054                   .dbend
 0054                   .dbfunc e USART_Init _USART_Init fV
 0054           ;           baud -> R20,R21
                        .even
 0054           _USART_Init::
 0054 00D0              rcall push_gset1
 0056 402F              mov R20,R16
 0058 512F              mov R21,R17
 005A                   .dbline -1
 005A                   .dbline 30
 005A           ; //#asm("sei");
 005A           ; //__enable_interrupt();
 005A           ; }    
 005A           ; 
 005A           ; void USART_Init(unsigned int  baud)
 005A           ; {
 005A                   .dbline 32
 005A           ; /* Set baud rate */
 005A           ; UBRRH = (unsigned char)(baud>>8);
 005A 242E              mov R2,R20
 005C 352E              mov R3,R21
 005E 232C              mov R2,R3
 0060 3324              clr R3
 0062 22B8              out 0x2,R2
 0064                   .dbline 33
 0064           ; UBRRL = (unsigned char)baud;
 0064 49B9              out 0x9,R20
 0066                   .dbline 35
 0066           ; /* Enable receiver and transmitter */
 0066           ; UCSRB = (1<<(UCSRB&0x10))|(1<<(UCSRB&0x08));
 0066 1AB1              in R17,0xa
 0068 1870              andi R17,8
 006A 01E0              ldi R16,1
 006C 00D0              rcall lsl8
 006E 202E              mov R2,R16
 0070 1AB1              in R17,0xa
 0072 1071              andi R17,16
 0074 01E0              ldi R16,1
 0076 00D0              rcall lsl8
 0078 302E              mov R3,R16
 007A 3228              or R3,R2
 007C 3AB8              out 0xa,R3
 007E                   .dbline 37
 007E           ; /* Set frame format: 8data, 2stop bit */
 007E           ; UCSRC = (1<<(UCSRC&0x08))|(3<<(UCSRC&0x02));
 007E 13B1              in R17,0x3
 0080 1270              andi R17,2
 0082 03E0              ldi R16,3
 0084 00D0              rcall lsl8
 0086 202E              mov R2,R16
 0088 13B1              in R17,0x3
 008A 1870              andi R17,8
 008C 01E0              ldi R16,1
 008E 00D0              rcall lsl8
 0090 302E              mov R3,R16
 0092 3228              or R3,R2
 0094 33B8              out 0x3,R3
 0096                   .dbline -2
 0096           L2:
 0096 00D0              rcall pop_gset1
 0098                   .dbline 0 ; func end
 0098 0895              ret
 009A                   .dbsym r baud 20 i
 009A                   .dbend
 009A                   .dbfunc e USART_Transmit _USART_Transmit fV
 009A           ;           data -> R20
                        .even
 009A           _USART_Transmit::
 009A 00D0              rcall push_gset1
 009C 402F              mov R20,R16
 009E                   .dbline -1
 009E                   .dbline 43
 009E           ; //U2X=0;
 009E           ; }
 009E           ; 
 009E           ; 
 009E           ; void USART_Transmit( unsigned char data )
 009E           ; {
 009E           L4:
 009E                   .dbline 45
 009E           L5:
 009E                   .dbline 45
 009E           ; /* Wait for empty transmit buffer */
 009E           ; while ( !( UCSRA & (1<<(UCSRA&0x20))) );
 009E 1BB1              in R17,0xb
 00A0 1072              andi R17,32
 00A2 01E0              ldi R16,1
 00A4 00D0              rcall lsl8
 00A6 2BB0              in R2,0xb
 00A8 2022              and R2,R16
 00AA C9F3              breq L4
 00AC                   .dbline 47
 00AC           ; /* Put data into buffer, sends the data */
 00AC           ; UDR = data;                                                                                    //Transmit 8  data  bits
 00AC 4CB9              out 0xc,R20
 00AE                   .dbline -2
 00AE           L3:
 00AE 00D0              rcall pop_gset1
 00B0                   .dbline 0 ; func end
 00B0 0895              ret
 00B2                   .dbsym r data 20 c
 00B2                   .dbend
 00B2                   .dbfunc e USART_Receive _USART_Receive fc
                        .even
 00B2           _USART_Receive::
 00B2                   .dbline -1
 00B2                   .dbline 66
 00B2           ; }
 00B2           ; 
 00B2           ; /*
 00B2           ; void USART_Transmit( unsigned int data )
 00B2           ; {
 00B2           ; //Wait for empty transmit buffer 
 00B2           ; while (!( UCSRA & (1<<UDRE)));
 00B2           ; // Copy 9th bit to TXB8 
 00B2           ; UCSRB &= ~(1<<TXB8);
 00B2           ; if ( data & 0x0100 )
 00B2           ; UCSRB |= (1<<TXB8);
 00B2           ; // Put data into buffer, sends the data 
 00B2           ; UDR = data;                                                                                   //Transmit 9  data  bits
 00B2           ; }
 00B2           ; */
 00B2           ; 
 00B2           ; 
 00B2           ; unsigned char USART_Receive( void )
 00B2           ; {
 00B2           L8:
 00B2                   .dbline 68
 00B2           L9:
 00B2                   .dbline 68
 00B2           ; // Wait for data to be received 
 00B2           ; while ( !(UCSRA & (1<<(UCSRA&0x80))) );
 00B2 1BB1              in R17,0xb
 00B4 1078              andi R17,128
 00B6 01E0              ldi R16,1
 00B8 00D0              rcall lsl8
 00BA 2BB0              in R2,0xb
 00BC 2022              and R2,R16
 00BE C9F3              breq L8
 00C0                   .dbline 70
 00C0           ; //Get and return received data from buffer 
 00C0           ; return UDR;                                                                                   //Receive  8  data  bits
 00C0 0CB1              in R16,0xc
 00C2                   .dbline -2
 00C2           L7:
 00C2                   .dbline 0 ; func end
 00C2 0895              ret
 00C4                   .dbend
 00C4                   .dbfunc e delay _delay fV
 00C4           ;              i -> R20,R21
 00C4           ;              j -> R22,R23
 00C4           ;             ms -> R16,R17
                        .even
 00C4           _delay::
 00C4 00D0              rcall push_gset2
 00C6                   .dbline -1
 00C6                   .dbline 94
 00C6           ; }
 00C6           ; 
 00C6           ; /*
 00C6           ; unsigned int USART_Receive( void )
 00C6           ; {
 00C6           ; unsigned char status, resh, resl;
 00C6           ; // Wait for data to be received 
 00C6           ; while ( !(UCSRA & (1<<RXC)) );
 00C6           ; // Get status and 9th bit, then data 
 00C6           ; // from buffer 
 00C6           ; status = UCSRA;
 00C6           ; resh = UCSRB;
 00C6           ; resl = UDR;
 00C6           ; // If error, return -1 
 00C6           ; if ( status & (1<<FE)|(1<<DOR)|(1<<UPE) )
 00C6           ; return -1;
 00C6           ; // Filter the 9th bit, then return 
 00C6           ; resh = (resh >> 1) & 0x01;
 00C6           ; return ((resh << 8) | resl);                  //Receive   9 data bits
 00C6           ; }
 00C6           ; */
 00C6           ; 
 00C6           ; void  delay(uint ms)
 00C6           ; {
 00C6                   .dbline 96
 00C6           ; uint i,j;
 00C6           ; for(i=0;i<ms;i++)
 00C6 4427              clr R20
 00C8 5527              clr R21
 00CA 0BC0              rjmp L15
 00CC           L12:
 00CC                   .dbline 97
 00CC           ;   {
 00CC                   .dbline 98
 00CC 6627              clr R22
 00CE 7727              clr R23
 00D0 02C0              rjmp L19
 00D2           L16:
 00D2                   .dbline 98
 00D2           L17:
 00D2                   .dbline 98
 00D2 6F5F              subi R22,255  ; offset = 1
 00D4 7F4F              sbci R23,255

⌨️ 快捷键说明

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