sweep_320_240.lst
来自「在采用 320x240 屏的设计实验箱上运行」· LST 代码 · 共 714 行 · 第 1/3 页
LST
714 行
div=5;
phase=Freq/2.8125;
}
if((Freq>=5759)&&(Freq<7199))
{
div=4;
phase=Freq/3.5156;
}
if((Freq>=7199)&&(Freq<10104))
{
div=3;
phase=Freq/4.9345;
}
if((Freq>=10104)&&(Freq<15157))
{
div=2;
phase=Freq/7.4017;
}
C51 COMPILER V7.06 SWEEP_320_240 02/25/2007 18:14:54 PAGE 5
if((Freq>=30316))
{
div=1;
phase=Freq/14.8034;
}
#endif
248 1 P0=phase&0xff;//((unsigned char *)&phase)[1];
249 1 Mh=0;
250 1 DC=1;
251 1 Cmd_CS=1;
252 1 Cmd_CS=0;
253 1 Cmd_CS=1;
254 1 P0=(div<<3)|((phase&0x0700)>>8);//((unsigned char *)&phase)[0];
255 1 Mh=1;
256 1 DC=1;
257 1 Cmd_CS=1;
258 1 Cmd_CS=0;
259 1 Cmd_CS=1;
260 1 }
261
262 void SetCMD(unsigned char Cmd)
263 {
264 1 P0=Cmd;
265 1 DC=0;
266 1 Cmd_CS=1;
267 1 Cmd_CS=0;
268 1 Cmd_CS=1;
269 1 }
270
271 void refresh_led()
272 {
273 1 led_display(10);
274 1 led_display(value[0]);
275 1 led_display(value[1]);
276 1 led_display(value[2]);
277 1 led_display(value[3]);
278 1 led_display(value[4]);
279 1 }
280
281 #define AP 0x2a
282
283
284 void display_mod(unsigned char mod)
285 {
286 1 /* Set_Display_Add(768);
287 1 printf("MOD:");
288 1 switch(mod)
289 1 {
290 1 case Wsin: printf("SIN ");
291 1 break;
292 1 case Wtri: printf("TRI ");
293 1 break;
294 1 case Wpul: printf("PULSE");
295 1 break;
296 1 case Wclr: printf("NONE ");
297 1 break;
298 1 }*/
299 1 // showchinese(0,0,mod)
300 1 unsigned int x=264 , y=64;
301 1 switch(mod)
302 1 {
303 2 case 0: showchinese(x,y,CD5FD);//正
C51 COMPILER V7.06 SWEEP_320_240 02/25/2007 18:14:54 PAGE 6
304 2 showchinese(x+16,y,CCFD2);//弦
305 2 showchinese(x+32,y,CB2A8);//波
306 2 initram_1();
307 2 show_123(sin);
308 2 break;
309 2 case 1: showchinese(x,y,CC8FD);//三
310 2 showchinese(x+16,y,CBDC7);//角
311 2 showchinese(x+32,y,CB2A8);//波
312 2 initram_1();
313 2 show_123(tri);
314 2 break;
315 2 case 2: showchinese(x,y,CBED8);//矩
316 2 showchinese(x+16,y,CD0CE);//形
317 2 showchinese(x+32,y,CB2A8);//波
318 2 initram_1();
319 2 show_123(pul);
320 2 break;
321 2 case 3: showchinese(x,y,CCEDE);//无
322 2 showchinese(x+16,y,CD0C5);//信
323 2 showchinese(x+32,y,CBAC5);//号
324 2 initram_1();
325 2 show_123(clr);
326 2 break;
327 2 default: break;
328 2 }
329 1 //show_wave(mod);
330 1 }
331
332 void show_fre(void)
333 {
334 1 unsigned int x=264,y=144 ;
335 1 show_num(x,y,CC000+(value[0]<<4));
336 1 show_num(x+8,y,CC000+(value[1]<<4));
337 1 show_num(x+16,y,CC000+(value[2]<<4));
338 1 show_num(x+24,y,CC000+(value[3]<<4));
339 1 show_num(x+32,y,CC000+(value[4]<<4));
340 1 }
341
342 void set_up(unsigned char flag)//flag!=0,setup;flag=0,none
343 {
344 1 if(flag)
345 1 {
346 2 showchinese(264,184,CC9E8);//设
347 2 showchinese(264+16,184,CD6C3);//置
348 2 }
349 1 else
350 1 {
351 2 showchinese(264,184,C0000);//00
352 2 showchinese(264+16,184,C0000);//00
353 2 }
354 1 }
355
356 /***************************************************************
357 *名称:showchinese(uchar x,uchar y,int chin)
358 *描述:在x,y位置处,显示字符码为chin
359 *参数:坐标x,坐标y
360 *返回:
361 ****************************************************************/
362 void showchinese(unsigned int x,unsigned int y,int chin)
363 {
364 1 int temp1,temp2;
365 1 uchar hi,lo;
C51 COMPILER V7.06 SWEEP_320_240 02/25/2007 18:14:54 PAGE 7
366 1 uchar b,c;
367 1 unsigned int d=x;
368 1 temp2=chin;
369 1 outcode(0x4F);
370 1 for(c=0;c<2;c++)
371 1 {
372 2 temp1=0x5000+d/8+y*AP;//5218
373 2 hi=temp1>>8;//hi=temp1/256;
374 2 lo=(uchar)temp1;//lo=temp1%256;
375 2 outcode(0x46);
376 2 outdata(lo);
377 2 outdata(hi);
378 2 outcode(0x42);
379 2 for(b=0;b<16;b++){
380 3 outdata(hzdot[temp2]);
381 3 temp2++;
382 3 }
383 2 d=d+8;
384 2 }
385 1 }
386 /***************************************************************
387 *名称:display_lead(void)
388 *描述:初始化液晶屏上第三层的汉字
389 *参数:
390 *返回:
391 ****************************************************************/
392 void display_lead(void)
393 {
394 1 uchar x=8;
395 1 uchar y=220;
396 1
397 1 showchinese(x,y,CC7EB);//请
398 1 showchinese(x+16,y,CB0B4);//按
399 1 showchinese(x+32,y,CC8B7);//确
400 1 showchinese(x+48,y,CB6A8);//定
401 1 showchinese(x+64,y,CBCFC);//键
402 1 showchinese(x+80,y,CCAE4);//输
403 1 showchinese(x+96,y,CC8EB);//入
404 1 showchinese(x+112,y,CC6B5);//频
405 1 showchinese(x+128,y,CC2CA);//率
406 1
407 1 showchinese(264,24,CC4A3);//模
408 1 showchinese(264+16,24,CCABD);//式
409 1 show_num(264+32,24,CC010);//:
410 1
411 1 showchinese(264,104,CC6B5);//频
412 1 showchinese(264+16,104,CC2CA);//率
413 1 show_num(264+32,104,CC010);//:
414 1
415 1 show_num(304,144,CC011);//H
416 1 show_num(312,144,CC012);//z
417 1 }
418 /***************************************************************
419 *名称:display_init(void)
420 *描述:初始化液晶屏和相关图形
421 *参数:
422 *返回:
423 ****************************************************************/
424 void display_init(void)
425 {
426 1 turnoff();
427 1 init();
C51 COMPILER V7.06 SWEEP_320_240 02/25/2007 18:14:54 PAGE 8
428 1 initram();
429 1 turnon();
430 1 DrawFrame();
431 1 DrawGrid();
432 1 display_lead();
433 1 }
434 /***************************************************************
435 *名称:showsine (void)
436 *描述:显示采样的结果,采64个点但显示256点
437 *参数:xr_temp[]显示数组,N_temp数组元素个数,
438 start_add图形开始的x地址,last上次显示最后一个元素
439 *返回:
440 ****************************************************************/
441 /*void showsine (uchar xr_temp[],uchar N_temp,uchar start_add,uchar last)
442 {
443 uchar i ;
444 WriteD(start_add,xr_temp[1]>>1);
445 vector(start_add-1,last>>1,xr_temp[1]>>1);
446 for(i=2;i<N_temp;i++)
447 {
448 WriteD(i-1+start_add,xr_temp[i]>>1);
449 vector(i-2+start_add,xr_temp[i-1]>>1,xr_temp[i]>>1);
450 }
451 }*/
452
453 void show_num (unsigned int x, unsigned int y, int chin)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?