📄 mb90092.lst
字号:
C51 COMPILER V7.02b MB90092 06/20/2006 18:46:35 PAGE 1
C51 COMPILER V7.02b, COMPILATION OF MODULE MB90092
OBJECT MODULE PLACED IN mb90092.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE mb90092.c DEBUG OBJECTEXTEND
stmt level source
1 /*
2
3 THIS SUBROUTINE IS FOR
4 MB90092 READ/WRITE
5
6 Descripton : the routine read/write the IC MB90092,use I2C communication line.
7 in the special address, save the "no any message" ,and " confirm to delete
8 the message " , and "key respectative "message
9 */
10 /*------------------------------------------------*/
11 /*----------------------------------*/
12 #include "externh.h"
13 #include "defineh.h"
14 #include "Sbitdef.h"
15 /*-----------------------------------*/
16 //extern void disp_num(uchar row,uchar col,uchar addr,uchar bc,uchar cc);
17 extern void Page_Read_Op();
18 extern uchar check_pagedown_command();
19 /*----------------------------------------*/
20 void disp_num(uchar row,uchar col,uint addr,uchar bc,uchar cc);
21 /*-------------------------------------------*/
22 /*
23 全屏清屏
24 */
25 /*-------------------------------------*/
26 void Clr_Display(void)
27 {
28 1 uchar data i,j;
29 1
30 1 for(j=0;j<12;j++)
31 1 {
32 2 for(i=0;i<24;i++)
33 2 {
34 3 disp_num(j,i,0x20,0,0);
35 3 }
36 2 }
37 1 }
38 /*-----------------------------------*/
39 /*
40 延时程序
41 */
42 void delay()
43 {
44 1 uchar data i;
45 1 for(i=0;i<0xff;i++)
46 1 {
47 2 _nop_();
48 2 }
49 1 }
50
51 /*---------------------------------*/
52 /*
53 程序名:send_byte()
54 参 数:I_data
55 返回值:无
C51 COMPILER V7.02b MB90092 06/20/2006 18:46:35 PAGE 2
56 功 能:将I_data值送至MB90092
57 */
58 /*------------------------------------------------*/
59 /*
60 发送字节到90092
61 I_data:待发送的数
62 */
63 void send_byte(uchar I_data)
64 {
65 1 uchar data i,temp;
66 1
67 1 MbCE=0x00;
68 1 for(i=0;i<8;i++)
69 1 {
70 2 MBSCLK=0x00;
71 2 temp = 0x01 & I_data;
72 2 if(temp == 0x00)
73 2 MBSIM= 0x00;
74 2 else
75 2 MBSIM= 0x01;
76 2 I_data=I_data >> 1;
77 2 MBSCLK=0x01;
78 2 }
79 1 MbCE=0x01;
80 1 }
81 /*----------------------------------------
82 row:行地址
83 在指定行显示反白
84 */
85 void disp_color(uchar row)
86 {
87 1 uchar data temp1,temp2;
88 1
89 1 temp1=row;
90 1
91 1 temp1=((temp1>>2)&0x3)+0x84;
92 1 temp2=row;
93 1 temp2=((temp2<<5)&0x60)+1;
94 1
95 1 send_byte(temp1); //command 0
96 1 send_byte(temp2);
97 1
98 1 send_byte(0x88); //command 1-1 or 1-2
99 1 send_byte(0x0);
100 1
101 1 send_byte(0x90); //command2-1
102 1 send_byte(0x0);
103 1 }
104
105 /*------------------------------------------------*/
106 /* row:行,col:列,addr:地址,bc:背景颜色,cc:前景颜色,*/
107 void disp_num(uchar row,uchar col,uint addr,uchar bc,uchar cc)
108 {
109 1 uchar data temp1,temp2,color;
110 1
111 1 temp1=row;
112 1 temp1=((temp1>>2)&0x03)+0x80;
113 1 send_byte(temp1); //command 0
114 1 temp1=row;
115 1 temp1=((temp1<<5)&0x60)+col;
116 1 send_byte(temp1);
117 1
C51 COMPILER V7.02b MB90092 06/20/2006 18:46:35 PAGE 3
118 1 send_byte(0xb0+2); //command 6
119 1 send_byte(0x20+row);
120 1
121 1 color=((cc<<4)&0x70)+bc; //bc=1
122 1
123 1 if(addr<0xb0a1)
124 1 {
125 2 addr=addr-0x20;
126 2 }
127 1 else
128 1 {
129 2 temp2=((addr&0xff00)>>8)&0x00ff;
130 2
131 2 addr=(temp2-0xb0)*94+((addr&0x00ff)-0xa1)+0x60;
132 2 }
133 1
134 1 temp1=(addr/128)&0X18; //00011000
135 1 temp2=temp1&0x10;
136 1 temp2=temp2>>3;
137 1
138 1 temp2=temp2&0x02;
139 1
140 1 temp1=temp1&0x08;
141 1 temp1=(temp1>>1)&0x04; //addr <0x1fff must
142 1 temp1=temp1+temp2;
143 1 send_byte(0x88+temp1);
144 1
145 1 temp1=(addr/128)&0X20;
146 1 temp1=temp1>>2; //addr <0x1fff must
147 1 temp1=temp1&0x80;
148 1 send_byte(color+temp1); //command1-1
149 1
150 1 temp1=(addr/128)&0X07;
151 1 send_byte(0x90+temp1); //command2-1
152 1 send_byte((addr%128)&0x7f);
153 1 }
154 /*----------------------------------------------*/
155 /*芯片初始化程序*/
156 void Init_MB90092(void)
157 {
158 1 // uchar i;
159 1 MbCE=0;
160 1 delay();
161 1 MbCE =1;
162 1 delay();
163 1 MbCE=0;
164 1 delay();
165 1 MbCE=1;
166 1 delay();
167 1 MbCE =0;
168 1 delay();
169 1 MbCE=1;
170 1 delay();
171 1 MbCE=0;
172 1 delay();
173 1 MbCE=1;
174 1
175 1 send_byte(0x98);/*--------command 3----------*/
176 1 send_byte(0); /*FIL 位,此命令可以不动 */
177 1
178 1 send_byte(0xaa);/*--------command 5----------*/
179 1 send_byte(0x10);/*;KID=0;APC与颜色有关;GYZ=0;W3--W0为行间距;10101 KID APC GYZ0 BH2 BH1 BH0 W3 W2
C51 COMPILER V7.02b MB90092 06/20/2006 18:46:35 PAGE 4
-W1 W0*/
180 1
181 1
182 1 send_byte(0xbd);/*--------command 7 10111101-bd,change to 10111101-b9---------*/
183 1 send_byte(0x27);/*垂直位置设定
184 1 ;10111 EC LP FO
185 1 ;00 Y5 Y4 Y3 Y2 Y1 Y0
186 1 ;EC:同步信号选择 EC=0 只用行同步信号 EC=1 行场共用
187 1 ;LP:LP=0 正常操作
188 1 ;LP=1 NTSC/PAL 格式
189 1 ;FO:颜色信号输出控制
190 1 ;Y5---Y0垂直位置设定*/
191 1
192 1 send_byte(0xc1);/*--------command 8 11000100-c4,change to 11000001-c1-----------*/
193 1 send_byte(0x02);/*水平位置设定*/
194 1
195 1 send_byte(0xc8);/*--------command 9---------*/
196 1 send_byte(0x00);
197 1
198 1
199 1 /*------背景设置1-------*/
200 1 send_byte(0xd1);//*--------command 10----------
201 1 send_byte(0x06);
202 1
203 1 /*1101000 RB
204 1 0 BK CC BC UC UG UR UB
205 1 RB:背影(solid-fill)选择
206 1 BK:闪烁;
207 1 CC:彩色/黑白选择
208 1 BC:背景颜色
209 1 UC:屏幕颜色
210 1 UG,UR,UB 颜色选择*/
211 1
212 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -