📄 mnj_1335.s
字号:
.module MNJ_1335.c
.area data(ram, con, rel)
_RX_data::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.blkb 3
.area idata
.byte 0,0,0
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.dbsym e RX_data _RX_data A[4:4]c
_RX_counter::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.dbsym e RX_counter _RX_counter c
_ParaSysTable8::
.blkb 2
.area idata
.byte 48,135
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.blkb 2
.area idata
.byte 7,39
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.blkb 2
.area idata
.byte 'B,240
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.blkb 2
.area idata
.byte 40,0
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.dbsym e ParaSysTable8 _ParaSysTable8 A[8:8]c
_ParaScrTableA::
.blkb 2
.area idata
.byte 0,0
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.blkb 2
.area idata
.byte 240,0
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.blkb 2
.area idata
.byte 64,240
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.blkb 2
.area idata
.byte 0,128
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.blkb 2
.area idata
.byte 0,0
.area data(ram, con, rel)
.dbfile MNJ_1335.c
.dbsym e ParaScrTableA _ParaScrTableA A[10:10]c
.area text(rom, con, rel)
.dbfile MNJ_1335.c
.dbfunc e delay_us _delay_us fV
; time -> R16,R17
.even
_delay_us::
.dbline -1
.dbline 106
; /*-------------------------------------------------------
; MD-500Ⅱ模拟定位机(ICCAVR)显示程序 2.0
; 作者:cyk8 2004.12.3
; 1、应包含头文件slavr.h
; 2、在工程选项中的Additional Lib中填入slavr
; 使编译器使用附加库文件libslavr.a
; 3、数据线D0~D7接PORTC
; WR------>用PD4代替
; RD------>用PD3代替
; A0------>用PD6代替
; RESET接RESET
; CS接地
; 4, 通讯协议:
; 主机发送的控制指令采用6个字符组成的字符串格式“(X/Y/S/C/G/T)”+数据1,数据2,数据3,数据4+“#”,
; 主机共发7B,7C,7D,7E,7F,
; a.第一个发的是X,Y,SAD,C,G,TH的ASCⅡ
; X--->58H(X)
; Y--->59H(Y)
; SAD->53H(S)
; C--->43H(C)
; G--->47H(G)
; TH-->54H(T)
; b.7B,7C,7D,7E四个数据
; c.最后一个7F=#23H(ASCⅡ="#"表示结束符号)
;
; ---------------------------------------------------------*/
; #include<ioM16V.h>
; #include <stdlib.h>
; #include <macros.h>
; #include <slavr.h>
;
; //宏定义//
; #define Uchar unsigned char
; #define Uint unsigned int
; #define paraP9 0x28 // 相对于320 X 240
; #define BasePart1 0x00
; #define BasePart2 0x40
; #define BasePart3 0x80
; #define BasePart4 0x00
; #define SystemSet 0x40
; #define Scroll 0x44
; #define DispOn 0x59
; #define DispOff 0x58
; #define Ovlay 0x5b
; #define HdotScr 0x5a
; #define CsrForm 0x5d
; #define CgramAdr 0x5c
; #define CsrDirR 0x4c
; #define CsrDirL 0x4d
; #define CsrDirU 0x4e
; #define CsrDirD 0x4f
; #define CsrW 0x46
; #define CsrR 0x47
; #define mWrite 0x42
; #define mRead 0x43
; #define A0_H PORTD |=0x40
; #define A0_L PORTD &=0xbf
; #define RD_H PORTD |=0x08
; #define WR_H PORTD |=0x10
; #define WR_L PORTD &=0xef
; #define LcmRdataPort A0_H
; #define LcmStatusPort A0_L
;
; unsigned char RX_data[4]={0}; //串口接收的数据
; unsigned char RX_counter=0; //串口接收到的字节数计数器
;
; void UART_init (void);
; void putchar (unsigned char c);
; void puts (unsigned char *s);
; void UART_rx (void);
; void delay_nms (unsigned int n);
;
; const Uchar *ptr; //液晶字符指针变量
;
; Uchar ParaSysTable8[]= {
; 0x30,0x87,0x07,0x27,0x42,0xf0,0x28,0x00 // P1-P8参数
; };
; Uchar ParaScrTableA[]= {
; 0x00,BasePart1,0xF0,0x00,BasePart2,0xF0,0x00,BasePart3,0x00,BasePart4
; };
;
; void PutCdotInAlpha( Uchar Ox, Uchar Oy, Uchar Cnumber );
; void PutWordInAlpha(void);
; void TextDisp( Uchar Ox,Uchar Oy, const Uchar *ptr );
; void LcmInition( void );
; void LcmClear( void );
; void SelfInit( void );
; void delay(Uint t);
; void RollLaft( void );
; void Rollright( void );
; void RollDown( void );
; void RollUp( void );
; void BuildCgram( Uchar Base, Uchar EndlCode );
; void PutWordInAlpha(void);
; void PutWordInGraph( void );
; void PutWord24InGraph( void );
; void Linexy(Uint x0,Uchar y0,Uint xt,Uchar yt,Uchar att);
; void Sample3( void );
; void Point(Uint Px, Uchar Py, Uchar attr );
;
;
;
;
; /* 微秒级延时函数(mS) 本延时函数实际为delay_us(int time)中的int time=1->实际等于2us */
; void delay_us(int time)
; {
L2:
.dbline 108
; do
; {
.dbline 109
; time--;
subi R16,1
sbci R17,0
.dbline 110
; }
L3:
.dbline 111
; while (time>1);
ldi R24,1
ldi R25,0
cp R24,R16
cpc R25,R17
brlt L2
.dbline -2
.dbline 112
; }
L1:
.dbline 0 ; func end
ret
.dbsym r time 16 I
.dbend
.dbfunc e delay_ms _delay_ms fV
; time -> R20,R21
.even
_delay_ms::
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 116
;
; /* 毫秒级延时函数 */
; void delay_ms(unsigned int time)
; {
xjmp L7
L6:
.dbline 118
.dbline 119
ldi R16,500
ldi R17,1
xcall _delay_us
.dbline 120
subi R20,1
sbci R21,0
.dbline 121
L7:
.dbline 117
; while(time!=0)
cpi R20,0
cpc R20,R21
brne L6
X0:
.dbline -2
.dbline 122
; {
; delay_us(500);
; time--;
; }
; }
L5:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r time 20 i
.dbend
.dbfunc e sed1335_write_command _sed1335_write_command fV
; commandcode -> R16
.even
_sed1335_write_command::
.dbline -1
.dbline 124
; void sed1335_write_command(Uchar commandcode)
; {
.dbline 125
; PORTC=commandcode;
out 0x15,R16
.dbline 126
; A0_H;
sbi 0x12,6
.dbline 127
; RD_H;
sbi 0x12,3
.dbline 128
; WR_L;
in R24,0x12
andi R24,239
out 0x12,R24
.dbline 129
; WR_H;
sbi 0x12,4
.dbline -2
.dbline 130
; }
L9:
.dbline 0 ; func end
ret
.dbsym r commandcode 16 c
.dbend
.dbfunc e sed1335_write_data _sed1335_write_data fV
; data -> R16
.even
_sed1335_write_data::
.dbline -1
.dbline 133
;
; void sed1335_write_data(Uchar data)
; {
.dbline 134
; PORTC=data;
out 0x15,R16
.dbline 135
; A0_L;
in R24,0x12
andi R24,191
out 0x12,R24
.dbline 136
; RD_H;
sbi 0x12,3
.dbline 137
; WR_L;
in R24,0x12
andi R24,239
out 0x12,R24
.dbline 138
; WR_H;
sbi 0x12,4
.dbline -2
.dbline 139
; }
L10:
.dbline 0 ; func end
ret
.dbsym r data 16 c
.dbend
.dbfunc e SelfInit _SelfInit fV
.even
_SelfInit::
.dbline -1
.dbline 142
; //CPU初始化//
; void SelfInit( void )
; {
.dbline 143
; DDRA =0xff;
ldi R24,255
out 0x1a,R24
.dbline 144
; PORTA = 0x00;
clr R2
out 0x1b,R2
.dbline 145
; DDRB =0xff;
out 0x17,R24
.dbline 146
; PORTB = 0x00;
out 0x18,R2
.dbline 147
; DDRC = 0xff;
out 0x14,R24
.dbline 148
; PORTC = 0x00;
out 0x15,R2
.dbline 149
; DDRD = 0xff;
out 0x11,R24
.dbline 150
; PORTD = 0xff;
out 0x12,R24
.dbline -2
.dbline 152
;
; }
L11:
.dbline 0 ; func end
ret
.dbend
.dbfunc e LcmInition _LcmInition fV
; i1 -> R20,R21
.even
_LcmInition::
xcall push_gset1
.dbline -1
.dbline 155
; //液晶初始化//
; void LcmInition( void )
; {
.dbline 157
; Uint i1;
; delay_ms(50);
ldi R16,50
ldi R17,0
xcall _delay_ms
.dbline 158
; delay_ms(50);
ldi R16,50
ldi R17,0
xcall _delay_ms
.dbline 159
; sed1335_write_command(SystemSet);
ldi R16,64
xcall _sed1335_write_command
.dbline 160
; sed1335_write_data(0x30);
ldi R16,48
xcall _sed1335_write_data
.dbline 161
; sed1335_write_data(0x87);
ldi R16,135
xcall _sed1335_write_data
.dbline 162
; sed1335_write_data(0x07);
ldi R16,7
xcall _sed1335_write_data
.dbline 163
; sed1335_write_data(0x27);
ldi R16,39
xcall _sed1335_write_data
.dbline 164
; sed1335_write_data(0x42);
ldi R16,66
xcall _sed1335_write_data
.dbline 165
; sed1335_write_data(0xf0);
ldi R16,240
xcall _sed1335_write_data
.dbline 166
; sed1335_write_data(0x28);
ldi R16,40
xcall _sed1335_write_data
.dbline 167
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 168
; sed1335_write_command(Scroll);
ldi R16,68
xcall _sed1335_write_command
.dbline 169
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 170
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 171
; sed1335_write_data(0xf0);
ldi R16,240
xcall _sed1335_write_data
.dbline 172
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 173
; sed1335_write_data(0x40);
ldi R16,64
xcall _sed1335_write_data
.dbline 174
; sed1335_write_data(0xf0);
ldi R16,240
xcall _sed1335_write_data
.dbline 175
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 176
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 177
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 178
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 179
; sed1335_write_command(HdotScr);
ldi R16,90
xcall _sed1335_write_command
.dbline 180
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 181
; sed1335_write_command(Ovlay);
ldi R16,91
xcall _sed1335_write_command
.dbline 182
; sed1335_write_data(0x0d);
ldi R16,13
xcall _sed1335_write_data
.dbline 183
; delay_ms(100);
ldi R16,100
ldi R17,0
xcall _delay_ms
.dbline 184
; i1=32768;
ldi R20,32768
ldi R21,128
.dbline 185
; sed1335_write_command(CsrDirR);
ldi R16,76
xcall _sed1335_write_command
.dbline 186
; sed1335_write_command(CsrW);
ldi R16,70
xcall _sed1335_write_command
.dbline 187
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 188
; sed1335_write_data(0x00);
clr R16
xcall _sed1335_write_data
.dbline 189
; sed1335_write_command(mWrite);
ldi R16,66
xcall _sed1335_write_command
xjmp L14
L13:
.dbline 190
.dbline 191
clr R16
xcall _sed1335_write_data
.dbline 192
L14:
.dbline 190
; while(i1--) {
movw R2,R20
subi R20,1
sbci R21,0
tst R2
brne L13
tst R3
brne L13
X1:
.dbline 193
; sed1335_write_data(0x00);
; }
; sed1335_write_command(DispOn);
ldi R16,89
xcall _sed1335_write_command
.dbline 194
; sed1335_write_data(0x15);
ldi R16,21
xcall _sed1335_write_data
.dbline -2
.dbline 195
; }
L12:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i1 20 i
.dbend
.area lit(rom, con, rel)
_ASC_MSK32::
.byte 0,0
.byte 0,0
.byte 0,0
.byte 3,6
.byte 12,24
.byte 24,24
.byte 48,48
.byte 48,48
.byte 48,48
.byte 48,48
.byte 48,24
.byte 24,24
.byte 12,6
.byte 3,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 224,48
.byte 24,12
.byte 12,4
.byte 6,6
.byte 6,6
.byte 6,6
.byte 6,6
.byte 6,4
.byte 12,12
.byte 24,48
.byte 224,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,1
.byte 31,1
.byte 1,1
.byte 1,1
.byte 1,1
.byte 1,1
.byte 1,1
.byte 1,1
.byte 1,1
.byte 1,3
.byte 31,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,192
.byte 248,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 7,8
.byte 16,32
.byte 32,48
.byte 48,0
.byte 0,0
.byte 0,0
.byte 0,1
.byte 2,4
.byte 8,16
.byte 32,63
.byte 63,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 224,56
.byte 24,12
.byte 12,12
.byte 12,12
.byte 24,16
.byte 32,64
.byte 128,0
.byte 0,4
.byte 4,4
.byte 12,248
.byte 248,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 7,24
.byte 48,48
.byte 48,48
.byte 0,0
.byte 0,3
.byte 0,0
.byte 0,0
.byte 0,48
.byte 48,48
.byte 48,24
.byte 7,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 192,'p
.byte 48,24
.byte 24,24
.byte 24,48
.byte 96,192
.byte 'p,24
.byte 8,12
.byte 12,12
.byte 12,8
.byte 24,48
.byte 192,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 1,1
.byte 2,6
.byte 4,8
.byte 8,16
.byte 32,32
.byte 127,0
.byte 0,0
.byte 0,0
.byte 0,3
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 48,'p
.byte 'p,240
.byte 'p,'p
.byte 'p,'p
.byte 'p,'p
.byte 'p,'p
.byte 'p,'p
.byte 254,'p
.byte 'p,'p
.byte 'p,'p
.byte 'p,254
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 15,15
.byte 8,8
.byte 8,16
.byte 16,19
.byte 20,24
.byte 16,0
.byte 0,0
.byte 0,48
.byte 48,32
.byte 32,16
.byte 15,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 252,252
.byte 0,0
.byte 0,0
.byte 0,224
.byte 48,24
.byte 8,12
.byte 12,12
.byte 12,12
.byte 12,24
.byte 24,48
.byte 192,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 1,3
.byte 4,8
.byte 24,24
.byte 16,48
.byte 49,54
.byte 60,56
.byte 48,48
.byte 48,48
.byte 24,24
.byte 12,6
.byte 3,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 240,8
.byte 12,12
.byte 0,0
.byte 0,0
.byte 240,24
.byte 12,6
.byte 6,6
.byte 6,6
.byte 6,4
.byte 12,24
.byte 224,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 31,31
.byte 56,48
.byte 32,32
.byte 0,0
.byte 0,0
.byte 0,0
.byte 1,1
.byte 1,3
.byte 3,3
.byte 3,3
.byte 3,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 252,252
.byte 8,16
.byte 16,32
.byte 32,64
.byte 64,128
.byte 128,128
.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,0
.byte 7,12
.byte 24,48
.byte 48,48
.byte 56,28
.byte 14,7
.byte 13,24
.byte 48,96
.byte 96,96
.byte 96,96
.byte 48,24
.byte 7,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 224,48
.byte 24,12
.byte 12,12
.byte 12,24
.byte 16,224
.byte 224,'p
.byte 56,28
.byte 12,12
.byte 12,12
.byte 24,48
.byte 192,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 7,24
.byte 48,48
.byte 96,96
.byte 96,96
.byte 96,96
.byte 48,24
.byte 15,0
.byte 0,0
.byte 0,48
.byte 48,48
.byte 15,0
.byte 0,0
.byte 0,0
.byte 0,0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -