📄 dso_fft.lst
字号:
C51 COMPILER V7.06 DSO_FFT 02/25/2007 18:04:19 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE DSO_FFT
OBJECT MODULE PLACED IN DSO_FFT.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE DSO_FFT.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 //波形显示在第一层,网格坐标显示在第二层,汉字菜单显示在第三层.
2 #include <reg51.h>
3 #include <absacc.h>
4 #include <math.h>
5 #include "constant.h"
6 #include "iCf.h"
7 #include "rCf.h"
8 #include "ziku.h"
9 #include "f_define.h"//函数定义
10 //输入频率92Hz
11 /***************************************************************
12 *名称:outcode(uchar code_data)
13 *描述:向液晶屏输出指令代码
14 *参数:指令代码
15 *返回:
16 ****************************************************************/
17 void outcode(uchar code_data)//输出指令代码
18 {
19 1 lcd_cs=0;
20 1 lcd_a0=1;
21 1 lcd_rd=1;lcd_wr=1;
22 1 P0=code_data;
23 1 lcd_wr=0;
24 1 lcd_wr=1;
25 1 lcd_cs=1;
26 1 }
27 /***************************************************************
28 *名称:outdata(uchar data_data)
29 *描述:向液晶屏输出指令参数
30 *参数:指令参数
31 *返回:
32 ****************************************************************/
33 void outdata(uchar data_data)//输出指令参数
34 {
35 1 lcd_cs=0;
36 1 lcd_a0=0;
37 1 lcd_rd=1;
38 1 lcd_wr=1;
39 1 P0=data_data;
40 1 lcd_wr=0;
41 1 lcd_wr=1;
42 1 lcd_cs=1;
43 1 }
44 /***************************************************************
45 *名称:uchar indata(void)
46 *描述:从液晶屏输入数据
47 *参数:
48 *返回:输入数据
49 ****************************************************************/
50 uchar indata(void)//输入数据
51 {
52 1 uchar data_data;
53 1 Ram_cs = 1 ;
54 1 lcd_cs=0;
55 1 lcd_a0=1;
C51 COMPILER V7.06 DSO_FFT 02/25/2007 18:04:19 PAGE 2
56 1 P0=0xff;
57 1 lcd_wr=1;
58 1 lcd_rd=0;
59 1 data_data=P0;
60 1 lcd_rd=1;
61 1 lcd_cs=1;
62 1 return data_data;
63 1 }
64 /***************************************************************
65 *名称:turnoff(void)
66 *描述:关闭液晶屏
67 *参数:
68 *返回:
69 ****************************************************************/
70 void turnoff(void)
71 {
72 1 outcode(0x58);//off screen
73 1 outdata(0x00);
74 1 }
75 /***************************************************************
76 *名称:turnon(void)
77 *描述:开启液晶屏
78 *参数:
79 *返回:
80 ****************************************************************/
81 void turnon(void)
82 {
83 1 outcode(0x59);//on screen
84 1 outdata(0x55);
85 1 }
86 /***************************************************************
87 *名称:initram(void)
88 *描述:清屏(3层)
89 *参数:
90 *返回:
91 ****************************************************************/
92 void initram(void)
93 {//显示存储器清零
94 1 unsigned int i;
95 1 outcode(0x4c);
96 1 outcode(0x46);
97 1 outdata(0x00);
98 1 outdata(0x00);
99 1 outcode(0x42);//clear screen memory
100 1 for(i=0;i<0x7800;)//24478,32768,0x7800,0x58e5
101 1 {
102 2 outdata(0x00);
103 2 i++;
104 2 }
105 1 }
106 /***************************************************************
107 *名称:initram_1(void)
108 *描述:清屏(first1层)
109 *参数:
110 *返回:
111 ****************************************************************/
112 void initram_1(void)
113 {//显示存储器清零
114 1 unsigned int i;
115 1 outcode(0x4c);
116 1 outcode(0x46);
117 1 outdata(0x00);
C51 COMPILER V7.06 DSO_FFT 02/25/2007 18:04:19 PAGE 3
118 1 outdata(0x00);
119 1 outcode(0x42);//clear screen memory
120 1 for(i=0;i<0x2800;i++)//24478,32768,0x7800,0x58e5
121 1 {
122 2 outdata(0x00);
123 2 }
124 1 }
125 /***************************************************************
126 *名称:init(void)
127 *描述:初始化程序
128 *参数:
129 *返回:
130 ****************************************************************/
131 void init(void)
132 {
133 1 int n;
134 1 outcode(0x40); /*SYSTEM SET 指令代码*/
135 1 for(n=0;n<8;n++)outdata(sys[n]); /*将参数P1-P8 写入*/
136 1 outcode(0x44); /*SCROLL 指令代码*/
137 1 for(n=0;n<10;n++)outdata(scr[n]); /*将参数P1-P10 写入*/
138 1 outcode(0x5a); /*HDOT SCR——P1 清零复位*/
139 1 outdata(0);
140 1 outcode(0x5b); /*OVLAY—*/
141 1 outdata(0x1c);
142 1 }
143 /***************************************************************
144 *名称:WriteD(uchar x,uchar y)
145 *描述:在第一层写一个点
146 *参数:点的坐标位置(x,y)
147 *返回:
148 ****************************************************************/
149 void WriteD(uchar x,uchar y) //write a dot on the 1nd layer
150 {
151 1 unsigned int address;
152 1 uchar addh,addl;
153 1 uchar m=0,n;
154 1 address=0x01f9+x/8+y*AP;
155 1 addh=address>>8;//addh=address/256;
156 1 addl=(uchar)address;//addl=address%256;
157 1 n=x%8;
158 1 outcode(0x46);
159 1 outdata(addl);
160 1 outdata(addh);
161 1 outcode(0x43);
162 1 m=indata();
163 1 m=m|arr[n];
164 1 outcode(0x46);
165 1 outdata(addl);
166 1 outdata(addh);
167 1 outcode(0x42);
168 1 outdata(m);
169 1 }
170 /***************************************************************
171 *名称:WriteD2(uchar x,uchar y)
172 *描述:在第二层写一个点
173 *参数:点的坐标位置(x,y)
174 *返回:
175 ****************************************************************/
176 void WriteD2(uchar x,uchar y) //write a dot on the 2nd layer
177 {
178 1 unsigned int address;
179 1 uchar addh,addl;
C51 COMPILER V7.06 DSO_FFT 02/25/2007 18:04:19 PAGE 4
180 1 uchar m=0,n=0;
181 1 address=0x29f9+x/8+y*AP;
182 1 addh=address>>8;//addh=address/256;
183 1 addl=(uchar)address;//addl=address%256;
184 1 outcode(0x46);
185 1 outdata(addl);
186 1 outdata(addh);
187 1 outcode(0x43);
188 1 m=indata();
189 1 n=x%8;
190 1 m=m|arr[n];
191 1 outcode(0x46);
192 1 outdata(addl);
193 1 outdata(addh);
194 1 outcode(0x42);
195 1 outdata(m);//m
196 1 }
197 /***************************************************************
198 *名称:Hori(uchar y,uchar space)
199 *描述:在第二层画水平网格线
200 *参数:网格的行数、空的点数
201 *返回:
202 ****************************************************************/
203 void Hori(uchar y,uchar space) //画水平网格线
204 {
205 1 uchar i;
206 1 outcode(0x4c);
207 1 for(i=space;i<LENGTH;i+=space)WriteD2(i,y);
208 1 }
209 /***************************************************************
210 *名称:Ver(uchar x,uchar space)
211 *描述:在第二层画垂直网格线
212 *参数:网格的列数、空的点数
213 *返回:
214 ****************************************************************/
215 void Ver(uchar x,uchar space) //画垂直网格线
216 {
217 1 uchar i=0 ;
218 1 outcode(0x4f);
219 1
220 1 if((x==0)|(x==0xfa))i=0;
221 1 else i=space;
222 1
223 1 for(;i<WIDTH;i+=space)WriteD2(x,i);
224 1 }
225 /***************************************************************
226 *名称:fixline(uchar y)
227 *描述:在第二层画横线
228 *参数:横线的行数
229 *返回:
230 ****************************************************************/
231 void fixline(uchar y)
232 {
233 1 unsigned int address;
234 1 uchar addh,addl;
235 1 uchar i;
236 1 address=0x2a18+y*AP;
237 1 addh=address>>8;//addh=address/256;
238 1 addl=(uchar)address;//addl=address%256;
239 1 outcode(0x46);
240 1 outdata(addl);
241 1 outdata(addh);
C51 COMPILER V7.06 DSO_FFT 02/25/2007 18:04:19 PAGE 5
242 1 outcode(0x4c);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -