📄 main.s
字号:
.module Main.c
.area text(rom, con, rel)
.dbfile F:\IccAvr_Pro\Main.c
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 18
; //ICC-AVR application builder : 2005-3-27 19:38:48
; // Target : M16
; // Crystal: 7.3728Mhz
; #include <iom16v.h>
; #include <macros.h>
; #include "Cpld_Read.h"
; #include "Display.h"
;
;
; //#define DEBUG
;
;
; //Global varible declare
; //unsigned char TimeFlag=0;
;
;
; void port_init(void)
; {
.dbline 19
; PORTA = 0xFF;
ldi R24,255
out 0x1b,R24
.dbline 20
; DDRA = 0x00;
clr R2
out 0x1a,R2
.dbline 21
; PORTB = 0xFF;
out 0x18,R24
.dbline 22
; DDRB = 0x0F;
ldi R24,15
out 0x17,R24
.dbline 23
; PORTC = 0xFF; //m103 output only
ldi R24,255
out 0x15,R24
.dbline 24
; DDRC = 0x00;
out 0x14,R2
.dbline 25
; PORTD = 0xFF;
out 0x12,R24
.dbline 26
; DDRD = 0x00;
out 0x11,R2
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 55
; }
;
; //TIMER0 initialisation - prescale:1
; // WGM: Normal
; // desired value: 200Hz
; // actual value: Out of range
; //void timer0_init(void)
; //{
; //TCCR0 = 0x00; //stop
; //TCNT0 = 0x70 ; //set count
; //OCR0 = 0x00 ; //set compare
; //TCCR0 = 0x01; //start timer
; //}
;
; /*#pragma interrupt_handler timer0_ovf_isr:10
; void timer0_ovf_isr(void)
; {
; TCNT0 = 0x70 ; //reload counter value
; TimeFlag=1;
; }*/
;
; //UART0 initialisation
; // desired baud rate: 115200
; // actual: baud rate:115200 (0.0%)
; // char size: 8 bit
; // parity: Disabled
;
; void init_devices(void)
; {
.dbline 57
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 58
; port_init();
xcall _port_init
.dbline 61
; //timer0_init();
;
; Cpld_Init();
xcall _Cpld_Init
.dbline 62
; Disp_Init();
xcall _Disp_Init
.dbline 63
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 64
; GICR = 0x00;
out 0x3b,R2
.dbline 65
; TIMSK = 0x01; //timer interrupt sources
ldi R24,1
out 0x39,R24
.dbline 66
; SEI(); //re-enable interrupts
sei
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
; CpldResult2 -> R20,R21
; CpldResult1 -> R22,R23
.even
_main::
.dbline -1
.dbline 71
; //all peripherals are now initialised
; }
;
; void main()
; {
.dbline 76
; int CpldResult1;
; int CpldResult2;
;
;
; init_devices();
xcall _init_devices
.dbline 77
; Cpld_Set();
xcall _Cpld_Set
xjmp L5
L4:
.dbline 80
.dbline 82
clr R16
xcall _Cpld_Read
movw R22,R16
.dbline 83
ldi R16,1
xcall _Cpld_Read
movw R20,R16
.dbline 90
clr R18
clr R19
movw R16,R22
xcall _Display
.dbline 91
ldi R18,2
ldi R19,0
movw R16,R20
xcall _Display
.dbline 94
L5:
.dbline 79
xjmp L4
X0:
.dbline -2
L3:
.dbline 0 ; func end
ret
.dbsym r CpldResult2 20 I
.dbsym r CpldResult1 22 I
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -