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

📄 initial.lis

📁 使用STK500_2 协议的bootloader
💻 LIS
字号:
                        .module initial.c
                        .area text(rom, con, rel)
 0000                   .dbfile F:\job\stk500\AVRMEG~1\bldSTK500\initial.c
 0000                   .dbfunc e globalParaInit _globalParaInit fV
                        .even
 0000           _globalParaInit::
 0000                   .dbline -1
 0000                   .dbline 24
 0000           ; /****************************************Copyright (c)**************************************************
 0000           ; **                                
 0000           ; **                                     开     发      部
 0000           ; **                              
 0000           ; ** 文   件   名: initial.c
 0000           ; ** 最后修改日期: 2006-1-23 13:47
 0000           ; ** 描        述: 初始化程序
 0000           ; ** 版      本: V1.0
 0000           ; ** 主  控  芯 片:M16  晶振频率:7.3728MHZ, 
 0000           ; **********************************************************************************************************/
 0000           ; #include <iom16v.h>
 0000           ; #include <macros.h>
 0000           ; #include "define.h"
 0000           ; #include "extern.h"
 0000           ; #include "function.h"
 0000           ; #include "command.h"
 0000           ; 
 0000           ; 
 0000           ; /**********************************************************************
 0000           ; functionName:void paraInit(void)
 0000           ; description:变量初始化
 0000           ; **********************************************************************/
 0000           ; void globalParaInit(void)
 0000           ; {
 0000                   .dbline 25
 0000           ;       statusMachine = ST_START;
 0000 80EF              ldi R24,240
 0002 80930000          sts _statusMachine,R24
 0006                   .dbline 26
 0006           ;       paramControllerInit=0x00;
 0006 2224              clr R2
 0008 20920000          sts _paramControllerInit,R2
 000C                   .dbline 27
 000C           ;       prgMode=0;
 000C 20920000          sts _prgMode,R2
 0010                   .dbline -2
 0010           L1:
 0010                   .dbline 0 ; func end
 0010 0895              ret
 0012                   .dbend
 0012                   .dbfunc e timer1_init _timer1_init fV
                        .even
 0012           _timer1_init::
 0012                   .dbline -1
 0012                   .dbline 35
 0012           ; 
 0012           ; }
 0012           ; //TIMER1 initialize - prescale:1024
 0012           ; // WGM: 0) Normal, TOP=0xFFFF
 0012           ; // desired value: 15Sec
 0012           ; // actual value: 15.000Sec (0.0%)
 0012           ; void timer1_init(void)
 0012           ; {
 0012                   .dbline 36
 0012           ;  TCCR1B = 0x00; //stop
 0012 2224              clr R2
 0014 2EBC              out 0x2e,R2
 0016                   .dbline 37
 0016           ;  TCNT1H = 0x2D; //setup
 0016 8DE2              ldi R24,45
 0018 8DBD              out 0x2d,R24
 001A                   .dbline 38
 001A           ;  TCNT1L = 0x11;
 001A 81E1              ldi R24,17
 001C 8CBD              out 0x2c,R24
 001E                   .dbline 39
 001E           ;  OCR1AH = 0xD2;
 001E 82ED              ldi R24,210
 0020 8BBD              out 0x2b,R24
 0022                   .dbline 40
 0022           ;  OCR1AL = 0xEF;
 0022 8FEE              ldi R24,239
 0024 8ABD              out 0x2a,R24
 0026                   .dbline 41
 0026           ;  OCR1BH = 0xD2;
 0026 82ED              ldi R24,210
 0028 89BD              out 0x29,R24
 002A                   .dbline 42
 002A           ;  OCR1BL = 0xEF;
 002A 8FEE              ldi R24,239
 002C 88BD              out 0x28,R24
 002E                   .dbline 43
 002E           ;  ICR1H  = 0xD2;
 002E 82ED              ldi R24,210
 0030 87BD              out 0x27,R24
 0032                   .dbline 44
 0032           ;  ICR1L  = 0xEF;
 0032 8FEE              ldi R24,239
 0034 86BD              out 0x26,R24
 0036                   .dbline 45
 0036           ;  TCCR1A = 0x00;
 0036 2FBC              out 0x2f,R2
 0038                   .dbline 46
 0038           ;  TCCR1B = 0x05; //start Timer
 0038 85E0              ldi R24,5
 003A 8EBD              out 0x2e,R24
 003C                   .dbline -2
 003C           L2:
 003C                   .dbline 0 ; func end
 003C 0895              ret
 003E                   .dbend
 003E                   .dbfunc e uart0Init _uart0Init fV
                        .even
 003E           _uart0Init::
 003E                   .dbline -1
 003E                   .dbline 61
 003E           ; }
 003E           ; 
 003E           ; /**********************************************************************
 003E           ; functionName:void uart0Init(void)
 003E           ; description:串口初始化函数
 003E           ; desired baud rate: UBRRL决定
 003E           ; UBRRL = 3; //115200
 003E           ; UBRRL = 7; //57600
 003E           ; UBRRL = 23; //19200
 003E           ; UBRRL = 47; //9600
 003E           ; char size: 8 bit
 003E           ; parity: Disabled
 003E           ; **********************************************************************/
 003E           ; void uart0Init(void)
 003E           ; {
 003E                   .dbline 62
 003E           ;       UCSRB = 0x00;           //disable while setting baud rate
 003E 2224              clr R2
 0040 2AB8              out 0xa,R2
 0042                   .dbline 63
 0042           ;       UCSRA = 0x02;
 0042 82E0              ldi R24,2
 0044 8BB9              out 0xb,R24
 0046                   .dbline 64
 0046           ;       UCSRC = 0x86;
 0046 86E8              ldi R24,134
 0048 80BD              out 0x20,R24
 004A                   .dbline 65
 004A           ;       UBRRL = BAUD115200;     //set baud rate lo
 004A 83E0              ldi R24,3
 004C 89B9              out 0x9,R24
 004E                   .dbline 66
 004E           ;       UBRRH = 0x00;           //set baud rate hi
 004E 20BC              out 0x20,R2
 0050                   .dbline 68
 0050           ; //    UCSRB = 0x98;           //使用中断
 0050           ;       UCSRB = 0x18;
 0050 88E1              ldi R24,24
 0052 8AB9              out 0xa,R24
 0054                   .dbline -2
 0054           L3:
 0054                   .dbline 0 ; func end
 0054 0895              ret
 0056                   .dbend
 0056                   .dbfunc e portInit _portInit fV
                        .even
 0056           _portInit::
 0056                   .dbline -1
 0056                   .dbline 79
 0056           ;       
 0056           ; }
 0056           ; 
 0056           ; 
 0056           ; 
 0056           ; /**********************************************************************
 0056           ; functionName:void portInit(void)
 0056           ; description:M16 IO初始化
 0056           ; **********************************************************************/
 0056           ; void portInit(void)
 0056           ; {
 0056                   .dbline 80
 0056           ;       PORTA=0xFF;
 0056 8FEF              ldi R24,255
 0058 8BBB              out 0x1b,R24
 005A                   .dbline 81
 005A           ;       DDRA=0x00;
 005A 2224              clr R2
 005C 2ABA              out 0x1a,R2
 005E                   .dbline 82
 005E           ;       PORTB=0xFF;
 005E 88BB              out 0x18,R24
 0060                   .dbline 83
 0060           ;       DDRB=0x00;
 0060 27BA              out 0x17,R2
 0062                   .dbline 84
 0062           ;       PORTC=0xFF;
 0062 85BB              out 0x15,R24
 0064                   .dbline 85
 0064           ;       DDRC=0x00;
 0064 24BA              out 0x14,R2
 0066                   .dbline 86
 0066           ;       PORTD=0xFF;
 0066 82BB              out 0x12,R24
 0068                   .dbline 87
 0068           ;       DDRD=0x00;
 0068 21BA              out 0x11,R2
 006A                   .dbline -2
 006A           L4:
 006A                   .dbline 0 ; func end
 006A 0895              ret
 006C                   .dbend
 006C                   .dbfunc e allInit _allInit fV
                        .even
 006C           _allInit::
 006C                   .dbline -1
 006C                   .dbline 98
 006C           ; }
 006C           ; 
 006C           ; 
 006C           ; 
 006C           ; 
 006C           ; /**********************************************************************
 006C           ; functionName:void allInit(void)
 006C           ; description:初始化所有的器件以及变量
 006C           ; **********************************************************************/
 006C           ; void allInit(void)
 006C           ; {
 006C                   .dbline 100
 006C           ;       //开始初始化工作
 006C           ;       CLI();                          //关闭中断源 
 006C F894              cli
 006E                   .dbline 101
 006E           ;       globalParaInit();               //变量初始化
 006E C8DF              xcall _globalParaInit
 0070                   .dbline 102
 0070           ;       portInit();                     //M16 IO初始化
 0070 F2DF              xcall _portInit
 0072                   .dbline 103
 0072           ;       uart0Init();                    //串口初始化函数
 0072 E5DF              xcall _uart0Init
 0074                   .dbline 104
 0074           ;       timer1_init();
 0074 CEDF              xcall _timer1_init
 0076                   .dbline 105
 0076           ;       MCUCR = 0x00;
 0076 2224              clr R2
 0078 25BE              out 0x35,R2
 007A                   .dbline 106
 007A           ;       GICR  = 0x00;
 007A 2BBE              out 0x3b,R2
 007C                   .dbline 107
 007C           ;       TIMSK = 0x00;                   
 007C 29BE              out 0x39,R2
 007E                   .dbline -2
 007E           L5:
 007E                   .dbline 0 ; func end
 007E 0895              ret
 0080                   .dbend

⌨️ 快捷键说明

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