📄 main.s
字号:
.module main.c
.area text(rom, con, rel)
.dbfile E:\work\avr\icc\cpld\stklcd\main.c
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 32
; //
; // File Name: main.c
; //
; // Title: Application entry point / driver
; //
; // Description: Main driver for LCD demo.
; //
; // Creation Date: 2/2/00 11:49:37 PM
; //
; // By: A.C. Verbeck
; //
; // This file is subject to the terms and conditions of the GNU General Public
; // License. See the file COPYING in the main directory of this archive
; // for more details.
; //
;
; #include <io8515v.h>
; #include <stdio.h>
; #include <macros.h>
;
; #include "BaseType.h"
; #include "lcd.h"
; #include "t0.h"
;
; static void Timer_Test(void);
; static void LCD_Test1(void);
; static void LCD_Test2(void);
;
; static Char pbuff[32];
;
; void main(void)
; {
.dbline 33
; SEI(); // Turn on the interrupts
sei
.dbline 34
; MCUCR = 0xc0; // Enable External RAM
ldi R24,192
out 0x35,R24
.dbline 36
;
; LCD_Test1(); // Do LCD test #2
.dbline -2
.dbline 37
; }
L1:
.dbline 0 ; func end
rjmp _LCD_Test1
.dbend
.dbfunc s Timer_Test _Timer_Test fV
; pb_val -> R20
.even
_Timer_Test:
rcall push_gset1
.dbline -1
.dbline 40
;
; static void Timer_Test(void)
; {
.dbline 43
; UInt8 pb_val;
;
; DDRB = 0xff;
ldi R24,255
out 0x17,R24
.dbline 44
; PORTB = 0x00;
clr R2
out 0x18,R2
.dbline 45
; T0_init();
rcall _T0_init
.dbline 46
; pb_val = 0;
clr R20
.dbline 47
L3:
.dbline 47
.dbline 48
ldi R16,10
ldi R17,0
rcall _T0_sleep
.dbline 49
inc R20
.dbline 50
mov R2,R20
com R2
out 0x18,R2
.dbline 51
.dbline 47
.dbline 47
rjmp L3
X0:
.dbline -2
L2:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r pb_val 20 c
.dbend
.dbfunc s LCD_Test1 _LCD_Test1 fV
; i -> R20,R21
.even
_LCD_Test1:
rcall push_gset1
sbiw R28,2
.dbline -1
.dbline 55
; TASK_LOOP {
; T0_sleep(10);
; ++pb_val;
; PORTB=~pb_val;
; }
; }
;
; static void LCD_Test1(void)
; {
.dbline 58
; UInt16 i;
;
; T0_init();
rcall _T0_init
.dbline 60
;
; LCD_reset();
rcall _LCD_reset
.dbline 61
; LCD_init();
rcall _LCD_init
.dbline 62
; LCD_command(LCD_HOME);
ldi R16,2
rcall _LCD_command
.dbline 63
; sprintf(pbuff, "Test display");
ldi R18,<L8
ldi R19,>L8
ldi R16,<_pbuff
ldi R17,>_pbuff
rcall _sprintf
.dbline 64
; LCD_puts(pbuff);
ldi R16,<_pbuff
ldi R17,>_pbuff
rcall _LCD_puts
.dbline 65
; LCD_command(LCD_NEW_LINE);
ldi R16,192
rcall _LCD_command
.dbline 67
;
; i=0;
clr R20
clr R21
.dbline 68
L9:
.dbline 68
.dbline 69
ldi R16,100
ldi R17,0
rcall _T0_sleep
.dbline 70
subi R20,255 ; offset = 1
sbci R21,255
.dbline 71
std y+0,R20
std y+1,R21
ldi R18,<L13
ldi R19,>L13
ldi R16,<_pbuff
ldi R17,>_pbuff
rcall _sprintf
.dbline 72
ldi R16,<_pbuff
ldi R17,>_pbuff
rcall _LCD_puts
.dbline 73
ldi R16,192
rcall _LCD_command
.dbline 74
.dbline 68
.dbline 68
rjmp L9
X1:
.dbline -2
L7:
adiw R28,2
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 s
.dbend
.dbfunc s LCD_Test2 _LCD_Test2 fV
; i -> R20,R21
.even
_LCD_Test2:
rcall push_gset1
.dbline -1
.dbline 79
; TASK_LOOP {
; T0_sleep(100);
; ++i;
; sprintf(pbuff, "Value = %d",i);
; LCD_puts(pbuff);
; LCD_command(LCD_NEW_LINE);
; }
; }
;
;
; static void LCD_Test2(void)
; {
.dbline 82
; UInt16 i;
;
; T0_init();
rcall _T0_init
.dbline 84
;
; LCD_reset();
rcall _LCD_reset
.dbline 85
; LCD_init();
rcall _LCD_init
.dbline 86
; LCD_command(LCD_HOME);
ldi R16,2
rcall _LCD_command
.dbline 88
L15:
.dbline 88
;
; TASK_LOOP {
.dbline 89
ldi R20,32
ldi R21,0
rjmp L22
L19:
.dbline 89
; for (i=0x20; i<0x80; i++) {
.dbline 90
; LCD_putc(i);
mov R16,R20
rcall _LCD_putc
.dbline 91
; T0_sleep(500);
ldi R16,500
ldi R17,1
rcall _T0_sleep
.dbline 92
; if ((i%16) == 0) {
mov R24,R20
mov R25,R21
andi R24,15
andi R25,0
cpi R24,0
cpc R24,R25
brne L23
X2:
.dbline 92
.dbline 93
; if ((i%32) == 0)
mov R24,R20
mov R25,R21
andi R24,31
andi R25,0
cpi R24,0
cpc R24,R25
brne L25
X3:
.dbline 94
; LCD_command(LCD_HOME);
ldi R16,2
rcall _LCD_command
rjmp L26
L25:
.dbline 96
; else
; LCD_command(LCD_NEW_LINE);
ldi R16,192
rcall _LCD_command
L26:
.dbline 97
; }
L23:
.dbline 98
L20:
.dbline 89
subi R20,255 ; offset = 1
sbci R21,255
L22:
.dbline 89
cpi R20,128
ldi R30,0
cpc R21,R30
brlo L19
.dbline 99
.dbline 88
.dbline 88
rjmp L15
X4:
.dbline -2
L14:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 s
.dbend
.area bss(ram, con, rel)
.dbfile E:\work\avr\icc\cpld\stklcd\main.c
_pbuff:
.blkb 32
.dbsym s pbuff _pbuff A[32:32]c
.area data(ram, con, rel)
.dbfile E:\work\avr\icc\cpld\stklcd\main.c
L13:
.blkb 11
.area idata
.byte 'V,'a,'l,'u,'e,32,61,32,37,'d,0
.area data(ram, con, rel)
.dbfile E:\work\avr\icc\cpld\stklcd\main.c
L8:
.blkb 13
.area idata
.byte 'T,'e,'s,'t,32,'d,'i,'s,'p,'l,'a,'y,0
.area data(ram, con, rel)
.dbfile E:\work\avr\icc\cpld\stklcd\main.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -