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

📄 time.lis

📁 用ICC编写的程序包括SPI
💻 LIS
字号:
                        .module time.c
                        .area data(ram, con, rel)
 0000           _time_flag::
 0000                   .blkb 1
                        .area idata
 0000 00                .byte 0
                        .area data(ram, con, rel)
 0001                   .dbfile F:\IccAvr_Pro\time.c
 0001                   .dbsym e time_flag _time_flag c
 0001           _pwm::
 0001                   .blkb 1
                        .area idata
 0001 7F                .byte 127
                        .area data(ram, con, rel)
 0002                   .dbfile F:\IccAvr_Pro\time.c
 0002                   .dbsym e pwm _pwm c
                        .area vector(rom, abs)
                        .org 16
 0010 0C940000          jmp _timer2_ovf_isr
                        .area data(ram, con, rel)
 0002                   .dbfile F:\IccAvr_Pro\time.c
                        .area text(rom, con, rel)
 0000                   .dbfile F:\IccAvr_Pro\time.c
 0000                   .dbfunc e timer2_ovf_isr _timer2_ovf_isr fV
                        .even
 0000           _timer2_ovf_isr::
 0000 2A92              st -y,R2
 0002 3A92              st -y,R3
 0004 0A93              st -y,R16
 0006 1A93              st -y,R17
 0008 2A93              st -y,R18
 000A 3A93              st -y,R19
 000C 8A93              st -y,R24
 000E 2FB6              in R2,0x3f
 0010 2A92              st -y,R2
 0012                   .dbline -1
 0012                   .dbline 10
 0012           ; 
 0012           ; #include "time.h"
 0012           ; 
 0012           ; unsigned char time_flag=0;
 0012           ; unsigned char pwm=0x7f;
 0012           ; extern int F;
 0012           ; extern int qep_cnt[];
 0012           ; #pragma interrupt_handler timer2_ovf_isr:5
 0012           ; void timer2_ovf_isr(void)
 0012           ; {
 0012                   .dbline 11
 0012           ;  TCNT2 = 0x64; //reload counter value
 0012 84E6              ldi R24,100
 0014 84BD              out 0x24,R24
 0016                   .dbline 12
 0016           ;  time_flag=1;
 0016 81E0              ldi R24,1
 0018 80930000          sts _time_flag,R24
 001C                   .dbline 13
 001C           ;  F=qep_cnt[0]*6;
 001C 20910000          lds R18,_qep_cnt
 0020 30910100          lds R19,_qep_cnt+1
 0024 06E0              ldi R16,6
 0026 10E0              ldi R17,0
 0028 0E940000          xcall empy16s
 002C 10930100          sts _F+1,R17
 0030 00930000          sts _F,R16
 0034                   .dbline 14
 0034           ;  qep_cnt[0]=0;
 0034 2224              clr R2
 0036 3324              clr R3
 0038 30920100          sts _qep_cnt+1,R3
 003C 20920000          sts _qep_cnt,R2
 0040                   .dbline -2
 0040                   .dbline 15
 0040           ; }
 0040           L1:
 0040 2990              ld R2,y+
 0042 2FBE              out 0x3f,R2
 0044 8991              ld R24,y+
 0046 3991              ld R19,y+
 0048 2991              ld R18,y+
 004A 1991              ld R17,y+
 004C 0991              ld R16,y+
 004E 3990              ld R3,y+
 0050 2990              ld R2,y+
 0052                   .dbline 0 ; func end
 0052 1895              reti
 0054                   .dbend
 0054                   .dbfunc e timer2_init _timer2_init fV
                        .even
 0054           _timer2_init::
 0054                   .dbline -1
 0054                   .dbline 22
 0054           ; 
 0054           ; //TIMER2 initialize - prescale:256
 0054           ; // WGM: Normal
 0054           ; // desired value: 5mSec
 0054           ; // actual value:  4.965mSec (0.7%)
 0054           ; void timer2_init(void)
 0054           ; {
 0054                   .dbline 23
 0054           ;  TCCR2 = 0x00; //stop
 0054 2224              clr R2
 0056 25BC              out 0x25,R2
 0058                   .dbline 24
 0058           ;  ASSR  = 0x00; //set async mode
 0058 22BC              out 0x22,R2
 005A                   .dbline 25
 005A           ;  TCNT2 = 0x64; //setup
 005A 84E6              ldi R24,100
 005C 84BD              out 0x24,R24
 005E                   .dbline 26
 005E           ;  OCR2  = 0x9C;
 005E 8CE9              ldi R24,156
 0060 83BD              out 0x23,R24
 0062                   .dbline 27
 0062           ;  TCCR2 = 0x06; //start
 0062 86E0              ldi R24,6
 0064 85BD              out 0x25,R24
 0066                   .dbline 28
 0066           ;  time_flag=0;
 0066 20920000          sts _time_flag,R2
 006A                   .dbline -2
 006A                   .dbline 29
 006A           ; }
 006A           L2:
 006A                   .dbline 0 ; func end
 006A 0895              ret
 006C                   .dbend
 006C                   .dbfunc e timer1_init _timer1_init fV
                        .even
 006C           _timer1_init::
 006C                   .dbline -1
 006C                   .dbline 36
 006C           ; 
 006C           ; //TIMER1 initialize - prescale:1
 006C           ; // WGM: 8) PWM phz freq correct, TOP=ICRn
 006C           ; // desired value: 14.4KHz
 006C           ; // actual value: 14.456KHz (0.4%)
 006C           ; void timer1_init(void)
 006C           ; {
 006C                   .dbline 37
 006C           ;  DDRD|=BIT(PORTD4)|BIT(PORTD5);
 006C 81B3              in R24,0x11
 006E 8063              ori R24,48
 0070 81BB              out 0x11,R24
 0072                   .dbline 38
 0072           ;  TCCR1B = 0x00; //stop
 0072 2224              clr R2
 0074 2EBC              out 0x2e,R2
 0076                   .dbline 39
 0076           ;  TCNT1H = 0xFF; //setup
 0076 8FEF              ldi R24,255
 0078 8DBD              out 0x2d,R24
 007A                   .dbline 40
 007A           ;  TCNT1L = 0x01;
 007A 81E0              ldi R24,1
 007C 8CBD              out 0x2c,R24
 007E                   .dbline 41
 007E           ;  OCR1AH = 0x00;
 007E 2BBC              out 0x2b,R2
 0080                   .dbline 42
 0080           ;  OCR1AL = 0x7f;
 0080 8FE7              ldi R24,127
 0082 8ABD              out 0x2a,R24
 0084                   .dbline 43
 0084           ;  OCR1BH = 0x00;
 0084 29BC              out 0x29,R2
 0086                   .dbline 44
 0086           ;  OCR1BL = 0x7f;
 0086 88BD              out 0x28,R24
 0088                   .dbline 45
 0088           ;  ICR1H  = 0x00;
 0088 27BC              out 0x27,R2
 008A                   .dbline 46
 008A           ;  ICR1L  = 0xFF;
 008A 8FEF              ldi R24,255
 008C 86BD              out 0x26,R24
 008E                   .dbline 47
 008E           ;  TCCR1A = 0xA0;
 008E 80EA              ldi R24,160
 0090 8FBD              out 0x2f,R24
 0092                   .dbline 48
 0092           ;  TCCR1B = 0x11; //start Timer
 0092 81E1              ldi R24,17
 0094 8EBD              out 0x2e,R24
 0096                   .dbline -2
 0096                   .dbline 49
 0096           ; }
 0096           L3:
 0096                   .dbline 0 ; func end
 0096 0895              ret
 0098                   .dbend
 0098                   .dbfunc e pwm_change _pwm_change fV
 0098           ;            pwm -> R16
                        .even
 0098           _pwm_change::
 0098                   .dbline -1
 0098                   .dbline 51
 0098           ; void pwm_change(unsigned char pwm)
 0098           ; {
 0098                   .dbline 52
 0098           ;  OCR1AH = 0x00;
 0098 2224              clr R2
 009A 2BBC              out 0x2b,R2
 009C                   .dbline 53
 009C           ;  OCR1AL = pwm;
 009C 0ABD              out 0x2a,R16
 009E                   .dbline 54
 009E           ;  OCR1BH = 0x00;
 009E 29BC              out 0x29,R2
 00A0                   .dbline 55
 00A0           ;  OCR1BL = pwm;
 00A0 08BD              out 0x28,R16
 00A2                   .dbline 56
 00A2           ;  ICR1H  = 0x00;
 00A2 27BC              out 0x27,R2
 00A4                   .dbline -2
 00A4                   .dbline 58
 00A4           ; 
 00A4           ; }
 00A4           L4:
 00A4                   .dbline 0 ; func end
 00A4 0895              ret
 00A6                   .dbsym r pwm 16 c
 00A6                   .dbend

⌨️ 快捷键说明

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