📄 h4001.lis
字号:
.module H4001.c
.area data(ram, con, rel)
0000 _error::
0000 .blkb 1
.area idata
0000 00 .byte 0
.area data(ram, con, rel)
0001 .dbfile D:\TK5552\Iccavr\H4001\H4001.c
0001 .dbsym e error _error c
0001 _post::
0001 .blkb 1
.area idata
0001 00 .byte 0
.area data(ram, con, rel)
0002 .dbfile D:\TK5552\Iccavr\H4001\H4001.c
0002 .dbsym e post _post c
0002 _run::
0002 .blkb 1
.area idata
0002 00 .byte 0
.area data(ram, con, rel)
0003 .dbfile D:\TK5552\Iccavr\H4001\H4001.c
0003 .dbsym e run _run c
0003 _head::
0003 .blkb 1
.area idata
0003 00 .byte 0
.area data(ram, con, rel)
0004 .dbfile D:\TK5552\Iccavr\H4001\H4001.c
0004 .dbsym e head _head c
0004 _tcomp::
0004 .blkb 2
.area idata
0004 0000 .word 0
.area data(ram, con, rel)
0006 .dbfile D:\TK5552\Iccavr\H4001\H4001.c
0006 .dbsym e tcomp _tcomp i
0006 _lastbit::
0006 .blkb 1
.area idata
0006 00 .byte 0
.area data(ram, con, rel)
0007 .dbfile D:\TK5552\Iccavr\H4001\H4001.c
0007 .dbsym e lastbit _lastbit c
0007 _half::
0007 .blkb 1
.area idata
0007 00 .byte 0
.area data(ram, con, rel)
0008 .dbfile D:\TK5552\Iccavr\H4001\H4001.c
0008 .dbsym e half _half c
.area lit(rom, con, rel)
0000 _ascii::
0000 30313233343536373839414243444546 .byte 48,49,50,51,52,53,54,55,56,57,'A,'B,'C,'D,'E,'F
0010 .dbsym e ascii _ascii A[16:16]kc
.area text(rom, con, rel)
0000 .dbfile D:\TK5552\Iccavr\H4001\H4001.c
0000 .dbfunc e port_init _port_init fV
.even
0000 _port_init::
0000 .dbline -1
0000 .dbline 36
0000 ; // --------------------------------------
0000 ; // Function: H4001 64位RFID只读卡读头
0000 ; // MCU: ATmega32
0000 ; // Crystal: 7.3728Mhz
0000 ; // Date: 2005/01/16
0000 ; // --------------------------------------
0000 ; // Compiler:
0000 ; // ICCAVR 6.28C,6.31A
0000 ; // RFID基站芯片:U2270B
0000 ; // --------------------------------------
0000 ;
0000 ; #include <iom32v.h>
0000 ; #include <macros.h>
0000 ; //variable definition
0000 ; unsigned char timer_count,error=0,post=0,data1,rxdata,run=0;
0000 ; unsigned char decode[192],head=0,rfiddata[54];
0000 ; unsigned int tcomp=0;
0000 ; unsigned char lastbit=0,half=0;
0000 ; const unsigned char ascii[16]="0123456789ABCDEF";
0000 ; //pin definition
0000 ; #define led() (PORTD^=0x80)
0000 ; #define RFW (1<<6)
0000 ; //RFW, RFID输出载波控制
0000 ; #define RFW_1() (PORTC |=RFW)
0000 ; #define RFW_0() (PORTC &=~RFW)
0000 ; #define beep (1<<4)
0000 ; #define beep_1() (PORTC |=beep)
0000 ; #define beep_0() (PORTC &=~beep)
0000 ; #define okled (1<<0)
0000 ; #define okled1() (PORTC |=okled)
0000 ; #define okled0() (PORTC &=~okled)
0000 ; //RFID_IN U2270B返回卡的未解调码
0000 ; #define RFID_IN (PINC&0x80)
0000 ;
0000 ; void port_init(void)
0000 ; {
0000 .dbline 37
0000 ; PORTA = 0xFF;
0000 8FEF ldi R24,255
0002 8BBB out 0x1b,R24
0004 .dbline 38
0004 ; DDRA = 0x00;
0004 2224 clr R2
0006 2ABA out 0x1a,R2
0008 .dbline 39
0008 ; PORTB = 0xFF;
0008 88BB out 0x18,R24
000A .dbline 40
000A ; DDRB = 0x00;
000A 27BA out 0x17,R2
000C .dbline 41
000C ; PORTC = 0xFF;
000C 85BB out 0x15,R24
000E .dbline 42
000E ; DDRC = 0x51;
000E 81E5 ldi R24,81
0010 84BB out 0x14,R24
0012 .dbline 43
0012 ; PORTD = 0x7F;
0012 8FE7 ldi R24,127
0014 82BB out 0x12,R24
0016 .dbline 44
0016 ; DDRD = 0x80;
0016 80E8 ldi R24,128
0018 81BB out 0x11,R24
001A .dbline -2
001A L1:
001A .dbline 0 ; func end
001A 0895 ret
001C .dbend
001C .dbfunc e timer0_init _timer0_init fV
.even
001C _timer0_init::
001C .dbline -1
001C .dbline 52
001C ; }
001C ;
001C ; //TIMER0 initialisation - prescale:1024
001C ; // WGM: Normal
001C ; // desired value: 10mSec
001C ; // actual value: 9.861mSec (1.4%)
001C ; void timer0_init(void)
001C ; {
001C .dbline 53
001C ; TCCR0 = 0x00; //stop
001C 2224 clr R2
001E 23BE out 0x33,R2
0020 .dbline 54
0020 ; TCNT0 = 0xB9; //set count
0020 89EB ldi R24,185
0022 82BF out 0x32,R24
0024 .dbline 55
0024 ; OCR0 = 0x47; //set compare
0024 87E4 ldi R24,71
0026 8CBF out 0x3c,R24
0028 .dbline 56
0028 ; TCCR0 = 0x05; //start timer
0028 85E0 ldi R24,5
002A 83BF out 0x33,R24
002C .dbline -2
002C L2:
002C .dbline 0 ; func end
002C 0895 ret
002E .dbend
.area vector(rom, abs)
.org 44
002C 0C941700 jmp _timer0_ovf_isr
.area text(rom, con, rel)
002E .dbfile D:\TK5552\Iccavr\H4001\H4001.c
002E .dbfunc e timer0_ovf_isr _timer0_ovf_isr fV
.even
002E _timer0_ovf_isr::
002E 2A92 st -y,R2
0030 8A93 st -y,R24
0032 9A93 st -y,R25
0034 2FB6 in R2,0x3f
0036 2A92 st -y,R2
0038 .dbline -1
0038 .dbline 61
0038 .dbline 62
0038 89EB ldi R24,185
003A 82BF out 0x32,R24
003C .dbline 63
003C 8091F800 lds R24,_timer_count
0040 8F5F subi R24,255 ; addi 1
0042 8093F800 sts _timer_count,R24
0046 .dbline 64
0046 82E3 ldi R24,50
0048 2090F800 lds R2,_timer_count
004C 8215 cp R24,R2
004E 30F4 brsh L4
0050 .dbline 64
0050 .dbline 66
0050 2224 clr R2
0052 2092F800 sts _timer_count,R2
0056 .dbline 67
0056 81E0 ldi R24,1
0058 80930200 sts _run,R24
005C .dbline 68
005C L4:
005C .dbline -2
005C L3:
005C 2990 ld R2,y+
005E 2FBE out 0x3f,R2
0060 9991 ld R25,y+
0062 8991 ld R24,y+
0064 2990 ld R2,y+
0066 .dbline 0 ; func end
0066 1895 reti
0068 .dbend
0068 .dbfunc e timer1_init _timer1_init fV
.even
0068 _timer1_init::
0068 .dbline -1
0068 .dbline 76
0068 ; }
0068 ;
0068 ; #pragma interrupt_handler timer0_ovf_isr:12
0068 ; void timer0_ovf_isr(void)
0068 ; {
0068 ; TCNT0 = 0xB9; //reload counter value
0068 ; timer_count++;
0068 ; if (timer_count>50) { // 0.01*50=0.5sec,每0.5秒扫描一次是否有ID卡
0068 ; // led();
0068 ; timer_count=0;
0068 ; run=1;
0068 ; }
0068 ; }
0068 ;
0068 ; //TIMER1 initialisation - prescale:1
0068 ; // WGM: 0) Normal, TOP=0xFFFF
0068 ; // desired value: 1Hz
0068 ; // actual value: Out of range
0068 ; void timer1_init(void)
0068 ; {
0068 .dbline 77
0068 ; TCCR1B = 0x00; //stop
0068 2224 clr R2
006A 2EBC out 0x2e,R2
006C .dbline 78
006C ; TCNT1H = 0x00 /*INVALID SETTING*/; //setup
006C 2DBC out 0x2d,R2
006E .dbline 79
006E ; TCNT1L = 0x00 /*INVALID SETTING*/;
006E 2CBC out 0x2c,R2
0070 .dbline 80
0070 ; OCR1AH = 0x00 /*INVALID SETTING*/;
0070 2BBC out 0x2b,R2
0072 .dbline 81
0072 ; OCR1AL = 0x00 /*INVALID SETTING*/;
0072 2ABC out 0x2a,R2
0074 .dbline 82
0074 ; OCR1BH = 0x00 /*INVALID SETTING*/;
0074 29BC out 0x29,R2
0076 .dbline 83
0076 ; OCR1BL = 0x00 /*INVALID SETTING*/;
0076 28BC out 0x28,R2
0078 .dbline 84
0078 ; ICR1H = 0x00 /*INVALID SETTING*/;
0078 27BC out 0x27,R2
007A .dbline 85
007A ; ICR1L = 0x00 /*INVALID SETTING*/;
007A 26BC out 0x26,R2
007C .dbline 86
007C ; TCCR1A = 0x00;
007C 2FBC out 0x2f,R2
007E .dbline 87
007E ; TCCR1B = 0x01; //start Timer
007E 81E0 ldi R24,1
0080 8EBD out 0x2e,R24
0082 .dbline -2
0082 L6:
0082 .dbline 0 ; func end
0082 0895 ret
0084 .dbend
0084 .dbfunc e uart0_init _uart0_init fV
.even
0084 _uart0_init::
0084 .dbline -1
0084 .dbline 96
0084 ; }
0084 ;
0084 ; //UART0 initialisation
0084 ; // desired baud rate: 9600
0084 ; // actual: baud rate:57600 (0.0%)
0084 ; // char size: 8 bit
0084 ; // parity: Disabled
0084 ; void uart0_init(void) //Uart初始化
0084 ; {
0084 .dbline 97
0084 ; UCSRB = 0x00; //disable while setting baud rate
0084 2224 clr R2
0086 2AB8 out 0xa,R2
0088 .dbline 98
0088 ; UCSRA = 0x00;
0088 2BB8 out 0xb,R2
008A .dbline 99
008A ; UCSRC = 0x06;
008A 86E0 ldi R24,6
008C 80BD out 0x20,R24
008E .dbline 100
008E ; UBRRL = 0x07; //set baud rate lo,9600=0x2F,57600=0x07
008E 87E0 ldi R24,7
0090 89B9 out 0x9,R24
0092 .dbline 101
0092 ; UBRRH = 0x00; //set baud rate hi
0092 20BC out 0x20,R2
0094 .dbline 102
0094 ; UCSRB = 0x98;
0094 88E9 ldi R24,152
0096 8AB9 out 0xa,R24
0098 .dbline -2
0098 L7:
0098 .dbline 0 ; func end
0098 0895 ret
009A .dbend
.area vector(rom, abs)
.org 52
0034 0C944D00 jmp _uart0_rx_isr
.area text(rom, con, rel)
009A .dbfile D:\TK5552\Iccavr\H4001\H4001.c
009A .dbfunc e uart0_rx_isr _uart0_rx_isr fV
.even
009A _uart0_rx_isr::
009A 2A92 st -y,R2
009C 2FB6 in R2,0x3f
009E 2A92 st -y,R2
00A0 .dbline -1
00A0 .dbline 107
00A0 ; }
00A0 ;
00A0 ; #pragma interrupt_handler uart0_rx_isr:14
00A0 ; void uart0_rx_isr(void) //接收中断处理
00A0 ; {
00A0 .dbline 109
00A0 ; //uart has received a character in UDR
00A0 ; rxdata=UDR;
00A0 2CB0 in R2,0xc
00A2 2092F600 sts _rxdata,R2
00A6 .dbline -2
00A6 L8:
00A6 2990 ld R2,y+
00A8 2FBE out 0x3f,R2
00AA 2990 ld R2,y+
00AC .dbline 0 ; func end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -