用89C2051实现的软PLC。PLC程序存在24C04,用按健输入程序
源代码在线查看: input.lst
C51 COMPILER V6.23a INPUT 12/13/2002 12:45:28 PAGE 1
C51 COMPILER V6.23a, COMPILATION OF MODULE INPUT
OBJECT MODULE PLACED IN input.OBJ
COMPILER INVOKED BY: D:\KEIL\C51\BIN\C51.EXE input.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include "reg51.h"
2
3 sbit load = P3^5;
4 sbit input_clk = P3^4;
5 sbit input_data = P3^3;
6
7 unsigned int input(void)
8 {
9 1 unsigned int temp = 0;
10 1 int i = 0;
11 1
12 1 input_clk = 0;
13 1 load = 0;
14 1 load = 1;
15 1 if (input_data == 1)
16 1 temp = 1;
17 1 for (i;i < 15;i++)
18 1 {
19 2 input_clk = 1;
20 2 temp = temp 21 2 if (input_data == 1)
22 2 temp = temp | 0x01;
23 2 input_clk = 0;
24 2 }
25 1 return temp;
26 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 51 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)