📄 test.lis
字号:
.module test.c
.area text(rom, con, rel)
0000 .dbfile E:\WaveShare\微雪电子CD1\开发板试验器\SD系列\M16SD\试验教程\外围模块相关试验\NOKIA3~1\Nokia3510i\test\test.c
0000 .dbfunc e port_init _port_init fV
.even
0000 _port_init::
0000 .dbline -1
0000 .dbline 28
0000 ; //ICC-AVR application builder : 2005-4-16 21:20:40
0000 ; // Target : M8
0000 ; // Crystal: 8.0000Mhz
0000 ;
0000 ; #include <iom16v.h>
0000 ; #include <macros.h>
0000 ;
0000 ; #define csl asm("cbi 0x18,0") //PB0
0000 ; #define csh asm("sbi 0x18,0")
0000 ;
0000 ; #define restl asm("cbi 0x12,1") //PB4
0000 ; #define resth asm("sbi 0x12,1")
0000 ;
0000 ; #define sclkl asm("cbi 0x18,7") //PB5
0000 ; #define sclkh asm("sbi 0x18,7")
0000 ;
0000 ; #define sdatal asm("cbi 0x18,5") //PB3
0000 ; #define sdatah asm("sbi 0x18,5")
0000 ; #define CS 3
0000 ; #define SCLK 7
0000 ; #define SDATA 5
0000 ; #define RESET 2
0000 ;
0000 ; #define CMD 0
0000 ; #define DATA 1
0000 ;
0000 ; void port_init(void)
0000 ; {
0000 .dbline 29
0000 ; PORTB = 0xFF;
0000 8FEF ldi R24,255
0002 88BB out 0x18,R24
0004 .dbline 30
0004 ; DDRB = 0x00;
0004 2224 clr R2
0006 27BA out 0x17,R2
0008 .dbline 31
0008 ; PORTC = 0x7F; //m103 output only
0008 8FE7 ldi R24,127
000A 85BB out 0x15,R24
000C .dbline 32
000C ; DDRC = 0x00;
000C 24BA out 0x14,R2
000E .dbline 33
000E ; PORTD = 0xFF;
000E 8FEF ldi R24,255
0010 82BB out 0x12,R24
0012 .dbline 34
0012 ; DDRD = 0x00;
0012 21BA out 0x11,R2
0014 .dbline -2
0014 L1:
0014 .dbline 0 ; func end
0014 0895 ret
0016 .dbend
0016 .dbfunc e init_devices _init_devices fV
.even
0016 _init_devices::
0016 .dbline -1
0016 .dbline 39
0016 ; }
0016 ;
0016 ; //call this routine to initialise all peripherals
0016 ; void init_devices(void)
0016 ; {
0016 .dbline 42
0016 ; //stop errant interrupts until set up
0016 ; //CLI(); //disable all interrupts
0016 ; port_init();
0016 F4DF xcall _port_init
0018 .dbline 44
0018 ;
0018 ; MCUCR = 0x00;
0018 2224 clr R2
001A 25BE out 0x35,R2
001C .dbline 45
001C ; GICR = 0x00;
001C 2BBE out 0x3b,R2
001E .dbline 46
001E ; TIMSK = 0x00; //timer interrupt sources
001E 29BE out 0x39,R2
0020 .dbline -2
0020 L2:
0020 .dbline 0 ; func end
0020 0895 ret
0022 .dbend
0022 .dbfunc e delay5ms _delay5ms fV
0022 ; i -> y+0
.even
0022 _delay5ms::
0022 2297 sbiw R28,2
0024 .dbline -1
0024 .dbline 59
0024 ; //SEI(); //re-enable interrupts
0024 ; //all peripherals are now initialised
0024 ; }
0024 ;
0024 ; //
0024 ; //ICC-AVR application builder : 2005-4-16 21:20:40
0024 ; // Target : M8
0024 ; // Crystal: 8.0000Mhz
0024 ;
0024 ;
0024 ;
0024 ;
0024 ; void delay5ms(void) {
0024 .dbline 61
0024 2224 clr R2
0026 3324 clr R3
0028 3982 std y+1,R3
002A 2882 std y+0,R2
002C L4:
002C .dbline 61
002C L5:
002C .dbline 61
002C ; volatile int i;
002C ; for(i=0; i<2200; i++);
002C 8881 ldd R24,y+0
002E 9981 ldd R25,y+1
0030 0196 adiw R24,1
0032 9983 std y+1,R25
0034 8883 std y+0,R24
0036 .dbline 61
0036 8839 cpi R24,152
0038 E8E0 ldi R30,8
003A 9E07 cpc R25,R30
003C BCF3 brlt L4
003E .dbline -2
003E L3:
003E 2296 adiw R28,2
0040 .dbline 0 ; func end
0040 0895 ret
0042 .dbsym l i 0 I
0042 .dbend
0042 .dbfunc e send _send fV
0042 ; cd -> R18
0042 ; myData -> R16
.even
0042 _send::
0042 .dbline -1
0042 .dbline 69
0042 ; }
0042 ;
0042 ; //----------------------------
0042 ; //发送指令或数据 硬件SPI
0042 ; //速度快,没有刷屏现象
0042 ; //----------------------------
0042 ; void send(unsigned char myData,unsigned char cd)
0042 ; {
0042 .dbline 70
0042 ; if(cd==DATA)
0042 2130 cpi R18,1
0044 29F4 brne L9
0046 .dbline 71
0046 ; {
0046 .dbline 72
0046 ; csl;
0046 C098 cbi 0x18,0
0048 .dbline 73
0048 ; sclkl;
0048 C798 cbi 0x18,7
004A .dbline 74
004A ; sdatah;
004A C59A sbi 0x18,5
004C .dbline 75
004C ; sclkh;
004C C79A sbi 0x18,7
004E .dbline 76
004E ; }
004E 04C0 xjmp L10
0050 L9:
0050 .dbline 78
0050 ; else
0050 ; {
0050 .dbline 79
0050 ; csl;
0050 C098 cbi 0x18,0
0052 .dbline 81
0052 ;
0052 ; sclkl;
0052 C798 cbi 0x18,7
0054 .dbline 82
0054 ; sdatal;
0054 C598 cbi 0x18,5
0056 .dbline 83
0056 ; sclkh;
0056 C79A sbi 0x18,7
0058 .dbline 85
0058 ;
0058 ; }
0058 L10:
0058 .dbline 86
0058 ; SPCR = 0x50; //setup SPI
0058 80E5 ldi R24,80
005A 8DB9 out 0xd,R24
005C .dbline 88
005C ;
005C ; SPDR = myData;
005C 0FB9 out 0xf,R16
005E L11:
005E .dbline 90
005E L12:
005E .dbline 90
005E ;
005E ; while(!(SPSR & 0x80));
005E 779B sbis 0xe,7
0060 FECF rjmp L11
0062 .dbline 92
0062 ;
0062 ; csh;
0062 C09A sbi 0x18,0
0064 .dbline 93
0064 ; SPCR = 0x00;
0064 2224 clr R2
0066 2DB8 out 0xd,R2
0068 .dbline -2
0068 L8:
0068 .dbline 0 ; func end
0068 0895 ret
006A .dbsym r cd 18 c
006A .dbsym r myData 16 c
006A .dbend
006A .dbfunc e send2 _send2 fV
006A ; cd -> R18
006A ; data -> R16
.even
006A _send2::
006A .dbline -1
006A .dbline 103
006A ;
006A ;
006A ; }
006A ;
006A ; //----------------------------
006A ; //发送指令或数据 软件模拟SPI
006A ; //速度较慢,有刷屏现象
006A ; //----------------------------
006A ; void send2(char data, char cd)
006A ; {
006A .dbline 105
006A ; // CS auf Low setzen
006A ; PORTD &= ~(0x01 << CS);
006A 9398 cbi 0x12,3
006C .dbline 108
006C ;
006C ; // Kommando oder Daten?
006C ; PORTB &= ~(0x01 << SCLK);
006C C798 cbi 0x18,7
006E .dbline 109
006E ; if(cd == CMD)
006E 2223 tst R18
0070 11F4 brne L15
0072 .dbline 110
0072 ; PORTB &= ~(0x01 << SDATA);
0072 C598 cbi 0x18,5
0074 01C0 xjmp L16
0076 L15:
0076 .dbline 112
0076 ; else
0076 ; PORTB |= 0x01 << SDATA;
0076 C59A sbi 0x18,5
0078 L16:
0078 .dbline 113
0078 ; PORTB |= 0x01 << SCLK;
0078 C79A sbi 0x18,7
007A .dbline 116
007A ;
007A ; // 1. Bit (MSB)
007A ; PORTB &= ~(0x01 << SCLK);
007A C798 cbi 0x18,7
007C .dbline 117
007C ; if((data & 0x80) == 0x80)
007C 802F mov R24,R16
007E 8078 andi R24,128
0080 8038 cpi R24,128
0082 11F4 brne L17
0084 .dbline 118
0084 ; PORTB |= 0x01 << SDATA;
0084 C59A sbi 0x18,5
0086 01C0 xjmp L18
0088 L17:
0088 .dbline 120
0088 ; else
0088 ; PORTB &= ~(0x01 << SDATA);
0088 C598 cbi 0x18,5
008A L18:
008A .dbline 121
008A ; PORTB |= 0x01 << SCLK;
008A C79A sbi 0x18,7
008C .dbline 124
008C ;
008C ; // 2. Bit (MSB)
008C ; PORTB &= ~(0x01 << SCLK);
008C C798 cbi 0x18,7
008E .dbline 125
008E ; if((data & 0x40) == 0x40)
008E 802F mov R24,R16
0090 8074 andi R24,64
0092 8034 cpi R24,64
0094 11F4 brne L19
0096 .dbline 126
0096 ; PORTB |= 0x01 << SDATA;
0096 C59A sbi 0x18,5
0098 01C0 xjmp L20
009A L19:
009A .dbline 128
009A ; else
009A ; PORTB &= ~(0x01 << SDATA);
009A C598 cbi 0x18,5
009C L20:
009C .dbline 129
009C ; PORTB |= 0x01 << SCLK;
009C C79A sbi 0x18,7
009E .dbline 132
009E ;
009E ; // 3. Bit (MSB)
009E ; PORTB &= ~(0x01 << SCLK);
009E C798 cbi 0x18,7
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -