采用C51语言完成基于74HC595的串口键盘与LED指示灯单元设计
源代码在线查看: control.lst
C51 COMPILER V8.05a CONTROL 10/11/2008 10:55:51 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE CONTROL
OBJECT MODULE PLACED IN control.OBJ
COMPILER INVOKED BY: F:\Keil C51 V8\C51\BIN\C51.EXE control.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include
2 #include "commons.h"
3
4 sbit _p32 = P3^2;
5 sbit _p16 = P1^6;
6 sbit _p17 = P1^7;
7
8
9
10
11 //A/D转换的函数
12 unsigned int ad(); //定义AD转换函数
13
14 void ctr_routine(void) { //控制函数
15 1 char led_buf[6];
16 1 //A/D转换
17 1 unsigned int value = ad();
18 1
19 1
20 1 if (_menu_status == MENU_OFF) { //若菜单检测处于关闭阶段,则:
21 2 led_buf[0] = '^'; //第一字符改为测量标志符
22 2 to_string(&led_buf[1], 5, value); //将AD转换值组装到显示字符串中
23 2 print(led_buf); //打印现实字符串
24 2 }
25 1 }
26
27 /*
28 unsigned int ad() {
29 unsigned int result = 0;
30 unsigned char i = 0;
31 p16 = 0;
32 while(p32 == 0);
33 for ( ; i < 12 ; i++) {
34 p17 = 1;
35 delay();
36 p17 = 0;
37 result 38 result |= p32;
39 }
40 p17 = 1;
41 delay();
42 p17 = 0;
43 p16 = 1;
44 return result;
45 }*/
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 36 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 6
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
C51 COMPILER V8.05a CONTROL 10/11/2008 10:55:51 PAGE 2
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)