温度显示程序Word格式文档下载.docx
- 文档编号:16796521
- 上传时间:2022-11-26
- 格式:DOCX
- 页数:20
- 大小:23.15KB
温度显示程序Word格式文档下载.docx
《温度显示程序Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《温度显示程序Word格式文档下载.docx(20页珍藏版)》请在冰豆网上搜索。
Uf
0x8000
21.#define
a1
1.114e-12
22.#define
a2
-3.8071e-8
23.#define
a3
0.0023857
24.#define
a4
0.092139
25./*------------------------------CPU引脚定义---------------------------------*/
26.//t6963引脚分配
27.#define
CWADD
XBYTE[0x8100]
//写指令代码地址
28.#define
DWADD
XBYTE[0x8000]
//写数据通道地址
29.//MAX1169引脚分配
30.sbit
SCL
=
P1^0;
//定义串行时钟线所在口
使用时根据自己的需要来定义
31.sbit
SDA
P1^1;
//定义串行数据线所在口
32.//MAX5541引脚分配
33.sbit
SCLK
P1^3;
34.sbit
DIN
P1^4;
35.sbit
DA_CS=
P1^5;
//MAX5541片选端
36.
37.
38./*----------------------------全局变量定义---------------------------------*/
39.
SystemError;
40.
counter;
//中断次数
41.
float
temp_data;
42.
s;
43.
yk;
44.
signed
ek;
45.
46.
47./*----------------------------功能子程序段---------------------------------*/
48./*-------------------------------------------------------------------------
49.;
定时器中断服务子程序
50.---------------------------------------------------------------------------*/
51.//定时器计数初值为50000
52.//定时100ms,中断30次
53.timer0()
interrupt
1
using
54.{
55.
counter++;
56.
TH0
-100000/256;
57.
TL0
-100000%256;
58.}
59.
60./*--------------------------------------------------------------------------
61.;
t6963
62.---------------------------------------------------------------------------*/
63.//液晶显示器地址:
p27--CS
P26--C/D
WR--WR
RD--RD
则
64.//
00
0000
0000(数据通道)
65.//
01
0000(指令通道)
66.//
;
67.//g6963.c--图形方式下的汉字、字符显示程序
68.
69.void
sta01(void)
//判断状态位
70.{
71.
while((CWADD&
3)!
=3);
72.
73.
}
74.
75.void
sta3(void)
76.{
77.
78.while((CWADD&
8)!
=8);
79.
80.
81.
82.
83.//写指令和写数据子程序
84.
85.void
writecode(unsigned
com)
//写无参数指令
86.{
87.
sta01();
88.
CWADD=com;
89.
90.void
write1byte(unsigned
dat1,unsigned
//写单字节参数指令
91.{
92.
93.
DWADD=dat1;
94.
95.
96.
97.
98.void
write2byte(unsigned
dat2,unsigned
99.{
//写双字节参数指令
100.
101.
102.
103.
104.
105.
DWADD=dat2;
106.
107.
108.
109.
110.
111.
112.void
disp_ini(void)
//显示屏初始化子程序
113.{
114.
write2byte(0x00,0x00,0x40);
//设置显示区域首地址0000h
115.
write2byte(0x10,0x00,0x41);
//设置文本显示的宽度,即一行所占的字节数(12864t,16个8X8点阵字符)
116.
write2byte(0x00,0x08,0x42);
//设置图形显示区域首地址0800h,或为文本属性区域首地址
117.
write2byte(0x10,0x00,0x43);
//设置图形显示区域宽度,或为文本属性区域宽度(12864t,16个8x8点阵字符)
118.
119.
writecode(0xa7);
//光标形状设置
120.
writecode(0x9c);
//显示开关设置,g\t
all
on!
121.
writecode(0x80);
//显示方式设置,逻辑或合成
122.
123.
124.
125.void
clearram(void)
//清屏程序
126.{
127.
i;
128.
129.
write2byte(0x00,0x00,0x24);
//设置显示ram首地址0000h
130.
131.
writecode(0xb0);
//设置自动写方式
132.
133.
for(i=8192;
i>
0;
i--)
//往显示区域写0;
区域大小8k
134.
{
135.
sta3();
136.
DWADD=0;
137.
};
138.
139.
writecode(0xb2);
//关闭自动写指令
140.
141.
142.
143./*-----------------------------------------------------------------------------------------------------
144.
汉字点阵,存储在程序存储器中
145.
点阵:
16x16
146.
提取点阵方向:
横向(先上->
下,
再左->
右)
147.
字节掉转:
否
148.
字节方式:
C语言
149.-------------------------------------------------------------------------------------------------------*/
150.
151.unsigned
code
wen[32]={
152.0x00,0x43,0x32,0x12,0x83,0x62,0x22,0x0B,
温
153.0x10,0x27,0xE4,0x24,0x24,0x24,0x2F,0x20,
154.0x08,0xFC,0x08,0x08,0xF8,0x08,0x08,0xF8,
155.0x00,0xFC,0xA4,0xA4,0xA4,0xA4,0xFE,0x00};
156.
157.unsigned
du[32]={
158.0x01,0x00,0x3F,0x22,0x22,0x3F,0x22,0x23,
度
159.0x20,0x2F,0x22,0x21,0x20,0x43,0x8C,0x30,
160.0x00,0x84,0xFE,0x20,0x28,0xFC,0x20,0xE0,
161.0x00,0xF0,0x20,0x40,0x80,0x60,0x1E,0x04};
162.
163.unsigned
wei[32]={
164.0x00,0x10,0x0C,0x04,0x00,0xFF,0x01,0x01,
为
165.0x02,0x02,0x04,0x08,0x10,0x20,0x40,0x00,
166.0x80,0x80,0x80,0x80,0x84,0xFE,0x04,0x04,
167.0x04,0x84,0x64,0x24,0x04,0x04,0x28,0x10};
168.
169.unsigned
clearchar[16]
//擦除一个字符
170.0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
171.0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
172.};
173.
174.unsigned
dot[16]={
175.0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
176.0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00
177.};
178.
179.//本文件为8×
16点阵西文字库文件,字的横向8点构成一字节,左边点在字节的高位,字符点阵四角按左上角→右上角→左下角→右下角取字*/
180./*0
*/
181.unsigned
ch0[16]={
182.0x00,0x00,0x7C,0xC6,0xC6,0xCE,0xD6,0xD6,
183.0xE6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00};
184.
185./*1
186.unsigned
ch1[16]={
187.0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,
188.0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00};
189.
190./*2
191.unsigned
ch2[16]={
192.0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30,
193.0x60,0xC0,0xC6,0xFE,0x00,0x00,0x00,0x00};
194.
195./*3
196.unsigned
ch3[16]={
197.0x00,0x00,0x7C,0xC6,0x06,0x06,0x3C,0x06,
198.0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00};
199.
200./*4
201.unsigned
ch4[16]={
202.0x00,0x00,0x0C,0x1C,0x3C,0x6C,0xCC,0xFE,
203.0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00};
204.
205./*5
206.unsigned
ch5[16]={
207.0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xFC,0x0E,
208.0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00};
209.
210./*6
211.unsigned
ch6[16]={
212.0x00,0x00,0x38,0x60,0xC0,0xC0,0xFC,0xC6,
213.0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00};
214.
215./*7
216.unsigned
ch7[16]={
217.0x00,0x00,0xFE,0xC6,0x06,0x06,0x0C,0x18,
218.0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00};
219.
220./*8
221.unsigned
ch8[16]={
222.0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0xC6,
223.0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00};
224.
225./*9
226.unsigned
ch9[16]={
227.0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7E,0x06,
228.0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00
229.};
230.
231.
232.
233.
234.void
gshowword(unsigned
y,unsigned
x,unsigned
*w_no)
//图形方式下显示一个汉字字符(分为左右两半字模)
235.{
//128*64dots,x--显示在第x(0~15)字符列!
,y--显示在第y(0~63)点阵!
行,w_no为tab代码
236.
//调用示例:
gshowword(2,4,hao)
在第二行第四列显示"
好"
----gshowword(点阵行,字符列,数组首地址)
237.
num;
238.
d1,d2,i=16;
239.
num=y*16+x+0x800;
//16--每行显示宽度为16个字符;
0--图形显示区首地址为0800h
240.
241.
242.
243.
for(i=16;
244.
d1=num/256;
//得到显示屏上汉字显示的相对位置
245.
d2=num%256;
246.
write2byte(d2,d1,0x24);
247.
write1byte(*w_no,0xc0);
//写汉字左代码
248.
write1byte(*(w_no+16),0xc0);
//写汉字右代码
249.
w_no++;
250.
num+=0x10;
//显示ram地址修正
251.
252.
253.
254.
255.
256.void
gshowchar(unsigned
//图形方式下显示一个字符(分为左右两半字模)
257.{
258.
在第二点阵行第四字符列显示"
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.//////////////////////////////////////////////////////////////////////////////////////////////
278.
279.void
disp5ch(unsigned
long
var)
280.{
//带灭零处理及小数点的五位数显示子程序(可显示0.000~99.999),var指要显示的数据
281.
d4,d3,d2,d1,d0;
282.
d4=var/10000;
d3=(var%10000)/1000;
d2=(var%1000)/100;
d1=(var%1000)%100/
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 温度 显示 程序