?? main.s
字號:
.module main.c
.area text(rom, con, rel)
.dbfile D:\SOURCE~1\手持gps測量儀\main.c
.dbfile D:\SOURCE~1\手持gps測量儀\delay.h
.dbfunc e Delay_1us _Delay_1us fV
.even
_Delay_1us::
.dbline -1
.dbline 53
; #ifndef _DELAY_H
; #define _DELAY_H
;
; // mcu:avr crystal=8MHz
;
; /**************************************************************
; **函數(shù)功能:延時(shí)1us
; **輸入?yún)?shù):無
; **返回值:無
; **在本函數(shù)外定義變量:無
; **調(diào)用的函數(shù):NOP()
; **************************************************************/
; void Delay_1us(void);
;
; /**************************************************************
; **函數(shù)功能:us級延時(shí)
; **輸入?yún)?shù):xus:延時(shí)us數(shù)
; **返回值:無
; **在本函數(shù)外定義變量:無
; **調(diào)用的函數(shù):Delay_1us()
; **************************************************************/
; void Delay_Us(unsigned char xus);
;
; /**************************************************************
; **函數(shù)功能:延時(shí)1ms
; **輸入?yún)?shù):無
; **返回值:無
; **在本函數(shù)外定義變量:無
; **調(diào)用的函數(shù):NOP()
; **************************************************************/
; void Delay_1ms(void);
;
; /**************************************************************
; **函數(shù)功能:ms級延時(shí)
; **輸入?yún)?shù):xms:延時(shí)ms數(shù)
; **返回值:無
; **在本函數(shù)外定義變量:無
; **調(diào)用的函數(shù):Delay_1ms()
; **************************************************************/
; void Delay_Ms(unsigned int xms);
;
; /**************************************************************
; **函數(shù)功能:10us級延時(shí)
; **輸入?yún)?shù):x10us:延時(shí)x10us數(shù)
; **返回值:無
; **在本函數(shù)外定義變量:無
; **調(diào)用的函數(shù):無
; **************************************************************/
; void Delay10us(Word x10us);
;
;
; void Delay_1us()
; {
.dbline 54
; NOP();
nop
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Delay_Us _Delay_Us fV
; i -> R10
; xus -> R12
.even
_Delay_Us::
st -y,R10
st -y,R12
mov R12,R16
.dbline -1
.dbline 58
; }
;
; void Delay_Us(unsigned char xus)
; {
.dbline 60
; unsigned char i;
; for(i=0;i<xus;i++)
clr R10
xjmp L6
L3:
.dbline 61
; Delay_1us();
xcall _Delay_1us
L4:
.dbline 60
inc R10
L6:
.dbline 60
cp R10,R12
brlo L3
X0:
.dbline -2
L2:
.dbline 0 ; func end
ld R12,y+
ld R10,y+
ret
.dbsym r i 10 c
.dbsym r xus 12 c
.dbend
.dbfunc e Delay_1ms _Delay_1ms fV
; i -> R16,R17
.even
_Delay_1ms::
.dbline -1
.dbline 65
; }
;
; void Delay_1ms(void)
; {
.dbline 67
; unsigned int i;
; for(i=0;i<1142;i++)
clr R16
clr R17
xjmp L11
L8:
.dbline 68
; ;
L9:
.dbline 67
subi R16,255 ; offset = 1
sbci R17,255
L11:
.dbline 67
cpi R16,118
ldi R30,4
cpc R17,R30
brlo L8
X1:
.dbline -2
L7:
.dbline 0 ; func end
ret
.dbsym r i 16 i
.dbend
.dbfunc e Delay_Ms _Delay_Ms fV
; i -> R20,R21
; j -> R22,R23
; xms -> R16,R17
.even
_Delay_Ms::
xcall push_xgsetF000
.dbline -1
.dbline 72
; }
;
; void Delay_Ms(Word xms) //crystal=8MHz
; {
.dbline 74
; Word i,j; //variable:declare Word
; for(i=0; i<xms; i++)
clr R20
clr R21
xjmp L16
L13:
.dbline 75
; for(j=0; j<498;j++)
clr R22
clr R23
xjmp L20
L17:
.dbline 76
; {
.dbline 77
; NOP();
nop
.dbline 78
; NOP();
nop
.dbline 79
; NOP();
nop
.dbline 80
; NOP();
nop
.dbline 81
; NOP();
nop
.dbline 82
; NOP();
nop
.dbline 83
; NOP();
nop
.dbline 84
; NOP();
nop
.dbline 85
; NOP();
nop
.dbline 86
; }
L18:
.dbline 75
subi R22,255 ; offset = 1
sbci R23,255
L20:
.dbline 75
cpi R22,242
ldi R30,1
cpc R23,R30
brlo L17
X2:
L14:
.dbline 74
subi R20,255 ; offset = 1
sbci R21,255
L16:
.dbline 74
cp R20,R16
cpc R21,R17
brlo L13
X3:
.dbline -2
L12:
.dbline 0 ; func end
xjmp pop_xgsetF000
.dbsym r i 20 i
.dbsym r j 22 i
.dbsym r xms 16 i
.dbend
.dbfunc e Delay10us _Delay10us fV
; i -> R20,R21
; j -> R22
; x10us -> R16,R17
.even
_Delay10us::
xcall push_xgsetF000
.dbline -1
.dbline 90
; }
;
; void Delay10us(Word x10us)//crystal=8MHz
; {
.dbline 92
; Word i;Byte j; //variable:declare Word
; for(i=0; i<x10us; i++)
clr R20
clr R21
xjmp L25
L22:
.dbline 93
; {
.dbline 94
; for(j=0;j<2;j++)
clr R22
xjmp L29
L26:
.dbline 95
; {
.dbline 96
; NOP();
nop
.dbline 97
; NOP();
nop
.dbline 98
; NOP();
nop
.dbline 99
; }
L27:
.dbline 94
inc R22
L29:
.dbline 94
cpi R22,2
brlo L26
X4:
.dbline 100
; }
L23:
.dbline 92
subi R20,255 ; offset = 1
sbci R21,255
L25:
.dbline 92
cp R20,R16
cpc R21,R17
brlo L22
X5:
.dbline -2
L21:
.dbline 0 ; func end
xjmp pop_xgsetF000
.dbsym r i 20 i
.dbsym r j 22 c
.dbsym r x10us 16 i
.dbend
.dbfile D:\SOURCE~1\手持gps測量儀\usart128.h
.dbfunc e Uart0_Init _Uart0_Init fV
.even
_Uart0_Init::
.dbline -1
.dbline 15
; #ifndef _USART_H
; #define _USART_H
;
; void Uart0_Init(void);
; void Usart_tarnsmit0(Byte x);
; void Uart1_Init(void);
; void Usart_tarnsmit1(Byte x);
;
; //UART0 initialize
; // desired baud rate: 9600
; // actual: baud rate:9615 (0.2%)
; // char size: 5 bits
; // parity: Disabled
; void Uart0_Init(void)
; {
.dbline 16
; UCSR0B = 0x00; //disable while setting baud rate
clr R2
out 0xa,R2
.dbline 17
; UCSR0A = 0x00;
out 0xb,R2
.dbline 18
; UCSR0C = 0x06;
ldi R24,6
sts 149,R24
.dbline 19
; UBRR0L = 0x33; //set baud rate lo baud rate = 19200 0.2%
ldi R24,51
out 0x9,R24
.dbline 20
; UBRR0H = 0x00; //set baud rate hi
sts 144,R2
.dbline 22
; //UCSR0B = 0x98;
; UCSR0B |= BIT(TXEN0) | BIT(RXEN0) | BIT(RXCIE0);
in R24,0xa
ori R24,152
out 0xa,R24
.dbline -2
L30:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Usart_tarnsmit0 _Usart_tarnsmit0 fV
; x -> R16
.even
_Usart_tarnsmit0::
.dbline -1
.dbline 25
; }
; void Usart_tarnsmit0(Byte x)
; {
L32:
.dbline 27
; //等待數(shù)據(jù)寄存器空
; while(!(UCSR0A&BIT(UDRE0)));//UDRE0為發(fā)送緩沖區(qū)空標(biāo)志位
L33:
.dbline 27
sbis 0xb,5
rjmp L32
X6:
.dbline 29
; //為1表示為空
; UDR0=x;
out 0xc,R16
.dbline -2
L31:
.dbline 0 ; func end
ret
.dbsym r x 16 c
.dbend
.dbfunc e Uart1_Init _Uart1_Init fV
.even
_Uart1_Init::
.dbline -1
.dbline 39
; }
;
;
; //UART1 initialize
; // desired baud rate:9600
; // actual baud rate:9615 (0.2%)
; // char size: 5 bits
; // parity: Disabled
; void Uart1_Init(void)
; {
.dbline 40
; UCSR1B = 0x00; //disable while setting baud rate
clr R2
sts 154,R2
.dbline 41
; UCSR1A = 0x00;
sts 155,R2
.dbline 42
; UCSR1C = 0x06;
ldi R24,6
sts 157,R24
.dbline 43
; UBRR1L = 0x33; //set baud rate lo baud rate = 9600 0.2%
ldi R24,51
sts 153,R24
.dbline 44
; UBRR1H = 0x00; //set baud rate hi
sts 152,R2
.dbline 46
; //UCSR1B = 0x98;
; UCSR1B |= BIT(TXEN1) | BIT(RXEN1) | BIT(RXCIE1);
lds R24,154
ori R24,152
sts 154,R24
.dbline -2
L35:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Usart_tarnsmit1 _Usart_tarnsmit1 fV
; x -> R16
.even
_Usart_tarnsmit1::
.dbline -1
.dbline 49
; }
; void Usart_tarnsmit1(Byte x)
; {
L37:
.dbline 51
; //等待數(shù)據(jù)寄存器空
; while(!(UCSR1A&BIT(UDRE1)));//UDRE0為發(fā)送緩沖區(qū)空標(biāo)志位
L38:
.dbline 51
lds R2,155
sbrs R2,5
rjmp L37
X7:
.dbline 53
; //為1表示為空
; UDR1=x;
sts 156,R16
.dbline -2
L36:
.dbline 0 ; func end
ret
.dbsym r x 16 c
.dbend
.dbfile D:\SOURCE~1\手持gps測量儀\initrialm128.h
.dbfunc e Init_Devices _Init_Devices fV
.even
_Init_Devices::
.dbline -1
.dbline 21
; //ICC-AVR application builder : 2007-6-27 10:26:06
; // Target : M8
; // Crystal: 8.0000Mhz
;
; /**************初始化m8函數(shù)***************/
; #ifndef Initrial_M128_H
; #define Initrial_M128_H
;
; void Init_Devices(void);
; void Port_Init(void);
; void Init_Devices(void);
; void Timer0_Init(void);
;
; void Timer0_Init(void);
;
; //void Timer1_Init(void);
; //void Timer1_Ovf_Isr(void);
;
; //call this routine to initialize all peripherals
; void Init_Devices(void)
; {
.dbline 23
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 24
; Port_Init();
xcall _Port_Init
.dbline 28
; //Timer0_Init();
; //Uart0_Init();
; //Uart1_Init();
; SEI(); //re-enable interrupts
sei
.dbline -2
L40:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Port_Init _Port_Init fV
.even
_Port_Init::
.dbline -1
.dbline 33
; //all peripherals are now initialized
; }
;
; void Port_Init(void)
; {
.dbline 34
; PORTA = 0xff;
ldi R24,255
out 0x1b,R24
.dbline 35
; DDRA = 0xff;
out 0x1a,R24
.dbline 36
; PORTB = 0xff;
out 0x18,R24
.dbline 37
; DDRB = 0xff;
out 0x17,R24
.dbline 38
; PORTC = 0xff; //m103 output only
out 0x15,R24
.dbline 39
; DDRC = 0xff;
out 0x14,R24
.dbline 40
; PORTD = 0xff;
out 0x12,R24
.dbline 41
; DDRD = 0xff;
out 0x11,R24
.dbline 42
; PORTE = 0xff;
out 0x3,R24
.dbline 43
; DDRE = 0xff;
out 0x2,R24
.dbline 44
; PORTF = 0xff;
sts 98,R24
.dbline 45
; DDRF = 0xff;
sts 97,R24
.dbline 46
; PORTG = 0xff;
sts 101,R24
.dbline 47
; DDRG = 0xff;
sts 100,R24
.dbline -2
L41:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Timer0_Init _Timer0_Init fV
.even
_Timer0_Init::
.dbline -1
.dbline 57
;
; //BEEP_PORT &=~ BIT(BEEP);
; }
;
; //TIMER0 initialize - prescale:1024
; // WGM: Normal
; // desired value: 10mSec
; // actual value: 9.984mSec (0.2%)
; void Timer0_Init(void)
; {
.dbline 58
; TCCR0 = 0x00; //stop
clr R2
out 0x33,R2
.dbline 59
; ASSR = 0x00; //set async mode
out 0x30,R2
.dbline 60
; TCNT0 = 0xB2; //set count
ldi R24,178
out 0x32,R24
.dbline 61
; OCR0 = 0x4E;
ldi R24,78
out 0x31,R24
.dbline 62
; TCCR0 = 0x07; //start timer prescale:1024
ldi R24,7
out 0x33,R24
.dbline 63
; TIMSK |= BIT(TOIE0); //timer0 interrupt sources
in R24,0x37
ori R24,1
out 0x37,R24
.dbline -2
L42:
.dbline 0 ; func end
ret
.dbend
.area lit(rom, con, rel)
_asciidot8x16::
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 56,252
.byte 252,56
.byte 0,0
.byte 0,0
.byte 0,13
.byte 13,0
.byte 0,0
.byte 0,14
.byte 30,0
.byte 0,30
.byte 14,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 32,248
.byte 248,32
.byte 248,248
.byte 32,0
.byte 2,15
.byte 15,2
.byte 15,15
.byte 2,0
.byte 56,124
.byte 'D,'G
.byte 'G,204
.byte 152,0
.byte 3,6
.byte 4,28
.byte 28,7
.byte 3,0
.byte 48,48
.byte 0,128
.byte 192,96
.byte 48,0
.byte 12,6
.byte 3,1
.byte 0,12
.byte 12,0
.byte 128,216
.byte 124,228
.byte 188,216
.byte 64,0
.byte 7,15
.byte 8,8
.byte 7,15
.byte 8,0
.byte 0,16
.byte 30,14
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 240,248
.byte 12,4
.byte 0,0
.byte 0,0
.byte 3,7
.byte 12,8
.byte 0,0
.byte 0,0
.byte 4,12
.byte 248,240
.byte 0,0
.byte 0,0
.byte 8,12
.byte 7,3
.byte 0,0
.byte 128,160
.byte 224,192
.byte 192,224
.byte 160,128
.byte 0,2
.byte 3,1
.byte 1,3
.byte 2,0
.byte 0,128
.byte 128,224
.byte 224,128
.byte 128,0
.byte 0,0
.byte 0,3
.byte 3,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 16,30
.byte 14,0
.byte 0,0
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,12
.byte 12,0
.byte 0,0
.byte 0,0
.byte 0,128
.byte 192,96
.byte 48,0
.byte 12,6
.byte 3,1
.byte 0,0
.byte 0,0
.byte 248,252
.byte 4,196
.byte 36,252
.byte 248,0
.byte 7,15
.byte 9,8
.byte 8,15
.byte 7,0
.byte 0,16
.byte 24,252
.byte 252,0
.byte 0,0
.byte 0,8
.byte 8,15
.byte 15,8
.byte 8,0
.byte 8,12
.byte 132,196
.byte 'd,60
.byte 24,0
.byte 14,15
.byte 9,8
.byte 8,12
.byte 12,0
.byte 8,12
.byte 'D,'D
.byte 'D,252
.byte 184,0
.byte 4,12
.byte 8,8
.byte 8,15
.byte 7,0
.byte 192,224
.byte 176,152
.byte 252,252
.byte 128,0
.byte 0,0
.byte 0,8
.byte 15,15
.byte 8,0
.byte 124,124
.byte 'D,'D
.byte 196,196
.byte 132,0
.byte 4,12
.byte 8,8
.byte 8,15
.byte 7,0
.byte 240,248
.byte 'L,'D
.byte 'D,192
.byte 128,0
.byte 7,15
.byte 8,8
.byte 8,15
.byte 7,0
.byte 12,12
.byte 4,132
.byte 196,124
.byte 60,0
.byte 0,0
.byte 15,15
.byte 0,0
.byte 0,0
.byte 184,252
.byte 'D,'D
.byte 'D,252
.byte 184,0
.byte 7,15
.byte 8,8
.byte 8,15
.byte 7,0
.byte 56,124
.byte 'D,'D
.byte 'D,252
.byte 248,0
.byte 0,8
.byte 8,8
.byte 12,7
.byte 3,0
.byte 0,0
.byte 0,48
.byte 48,0
.byte 0,0
.byte 0,0
.byte 0,6
.byte 6,0
.byte 0,0
.byte 0,0
.byte 0,48
.byte 48,0
.byte 0,0
.byte 0,0
.byte 8,14
.byte 6,0
.byte 0,0
.byte 0,128
.byte 192,96
.byte 48,24
.byte 8,0
.byte 0,0
.byte 1,3
.byte 6,12
.byte 8,0
.byte 64,64
.byte 64,64
.byte 64,64
.byte 64,0
.byte 2,2
.byte 2,2
.byte 2,2
.byte 2,0
.byte 0,8
.byte 24,48
.byte 96,192
.byte 128,0
.byte 0,8
.byte 12,6
.byte 3,1
.byte 0,0
.byte 24,28
.byte 4,196
.byte 228,60
.byte 24,0
.byte 0,0
.byte 0,13
.byte 13,0
.byte 0,0
.byte 240,248
.byte 8,200
.byte 200,248
.byte 240,0
.byte 7,15
.byte 8,11
.byte 11,11
.byte 1,0
.byte 224,240
.byte 152,140
.byte 152,240
.byte 224,0
.byte 15,15
.byte 0,0
.byte 0,15
.byte 15,0
.byte 4,252
.byte 252,'D
.byte 'D,252
.byte 184,0
.byte 8,15
.byte 15,8
.byte 8,15
.byte 7,0
.byte 240,248
.byte 12,4
.byte 4,12
.byte 24,0
.byte 3,7
.byte 12,8
.byte 8,12
.byte 6,0
.byte 4,252
.byte 252,4
.byte 12,248
.byte 240,0
.byte 8,15
.byte 15,8
.byte 12,7
.byte 3,0
.byte 4,252
.byte 252,'D
.byte 228,12
.byte 28,0
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -