📄 can-second.lst
字号:
C51 COMPILER V7.50 CAN_SECOND 05/15/2008 21:34:02 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE CAN_SECOND
OBJECT MODULE PLACED IN can-second.OBJ
COMPILER INVOKED BY: D:\专业软件安装包\keil C\C51\BIN\C51.EXE can-second.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <REGX52.H>
2 #include <intrins.h>
3 #include <absacc.H>
4 #include <LCD24064.h>
5 #include <SJA1000.h>
6 #include <KEY8255.h>
7 #include <ADC0809.h>
8 #include <6264.h>
9 #define uint unsigned int
10 #define uchar unsigned char
11 #define ulong unsigned long
12
13 bit manu1=0,manu2=0; // 显示汉字循环右移界面 标志位
14 bit flag_data=0; //接收新数据标志
15 uchar buf[10],ID2[4]; ////接收数据缓冲区和ID符区
16 uchar add=10;
17
18 /***********************************************************
19 主函数
20 ************************************************************/
21 void main(void)
22 {
23 1 uchar key,temp[8]={0x00,0x00,99,99,99,99,99,99}; ////temp[0]为实验序号变量
24 1 uchar code ID_send[4]={0,0,0,0};
25 1 uchar num=22;
26 1 bit double2=0,ok=0;
27 1 init_8255();
28 1 LcmInit();
29 1 LcmClear(0);
30 1 ////init_sja(); //SJA1000初始化////////////////////////////////////////////////////////////
31 1 EX0=1; //外部中断0允许控制位
32 1 IT0=1; //外部中断0触发方式选择位:IT0=0为低电平触发,IT0=1为下降沿触发
33 1 EA=1; //开总中断
34 1 P1_0=0; //关蜂鸣器
35 1
36 1 manu_init(0x11); //显示初始化界面/////showword(xia_x,0x12,0);画线
37 1 Delay(1000);
38 1
39 1 while(1)
40 1 {
41 2 key=key_scan();
42 2 if(key==11) { manu1=0; ok=0; manu2=0;double2=0; num=22; } //修改处理
43 2 if(manu1==0) //选择实验序号
44 2 { LcmClear(0);
45 3 manu_init(0x10);
46 3 manu_select();
47 3 while(manu1==0)
48 3 { key=key_scan();
49 4 if(key!=0xff&&key>=0&&key<10)
50 4 { temp[(num-22)]=key; PutData(num++,5,key); }
51 4 if(num>=24) { manu1=1; temp[0]=temp[0]*10+temp[1]; } //PutData2(5,5,e_num);
52 4 }
53 3 }////if(manu1==0)
54 2 if(manu1==1)
55 2 {
C51 COMPILER V7.50 CAN_SECOND 05/15/2008 21:34:02 PAGE 2
56 3 while(ok==0)
57 3 {
58 4 key=key_scan();
59 4 if(key==10&&double2==0)
60 4 { PutChar(26,5,0x2f);
61 5 PutChar(27,5,0x2b);
62 5 PutChar(28,5,0x1f);
63 5 double2=1;
64 5 }
65 4 else if(key==10&&double2==1)
66 4 { temp[1]=99;
67 5 /// send_dframe(ID_send,temp); ///////////////////////////////////////需加入
68 5 PutChar(28,5,0x01);
69 5 ok=1;
70 5 manu2=1; ///选择完 标志
71 5 Delay(1000);
72 5 }
73 4 }
74 3 ////PutData2(5,5,temp[0]);///检验实验设置OK否,此时manu1==1,ok==1,manu2==1
75 3 }/////if(manu1==1)
76 2 if(manu2==1)//空闲时显示初始化界面
77 2 {
78 3 LcmClear(0);
79 3 manu_init(0x11);
80 3 manu2=0;
81 3 }////////if(manu2==1)
82 2 /////////////////////////////////////接收数据处理/////////////////////////////////////////////////
83 2
84 2 if(flag_data==1)
85 2 {
86 3 LcmClear(0);
87 3 manu_data();
88 3 flag_data=0;
89 3 // manu2=1;//////空闲时显示初始化界面
90 3 }//if(flag_data==1)
91 2
92 2
93 2 }//while(1)
94 1 }//main()
*** WARNING C280 IN LINE 24 OF CAN-SECOND.C: 'ID_send': unreferenced local variable
95
96
97
98
99 void manu_xinxi(void)
100 {
101 1 uchar xx,yy;
102 1 LcmClear(0);
103 1 PutData2(8,1,ID2[0]);
104 1 PutChar(11,1,0x03);
105 1 showword(shi, 0x60,0);
106 1 showword(yan,0x70,0);
107 1 showword(tai_2,0x80,0); //显示实验台序号
108 1
109 1 showword(shi, 0x01,0);
110 1 showword(yan,0x11,0);
111 1 showword(mao_2,0x21,0);//显示实验序号
112 1 PutData2(4,3,ID2[1]);
113 1
114 1 showword(cao_2, 0x02,0);
115 1 showword(zuo_2,0x12,0);
116 1 showword(zhe_2,0x22,0);
C51 COMPILER V7.50 CAN_SECOND 05/15/2008 21:34:02 PAGE 3
117 1 showword(mao_2,0x32,0);//显示操作者
118 1 for(xx=0,yy=0;xx<6;yy+=2,xx++)//只读6个字节的学号
119 1 PutData2(6+yy,5,buf[xx]);
120 1 showword(lian_2, 0x53,0);
121 1 showword(jie_2,0x63,0);
122 1 showword(cheng_2,0x73,0);
123 1 showword(gong_2,0x83,0);//显示连接成功
124 1 }
125
126 void manu_data(void)
127 {
128 1 if(ID2[1]==0x01) //第一个实验
129 1 {
130 2 switch (ID2[2])
131 2 {
132 3 case 0x01: step_one(); break;
133 3 //case 0x02: step_two(); break;
134 3 //case 0x03: step_three(); break;
135 3 //case 0x04: step_four(); break;
136 3 }
137 2 }
138 1 /*
139 1 if(ID2[1]==0x02) //第二个实验
140 1 {
141 1 switch (ID[2])
142 1 {
143 1 case 0x01: return(9); break;
144 1 case 0x02: return(0); break;
145 1 case 0x03: return(10); break;//确认健
146 1 case 0x04: return(11); break;//修改健
147 1 case 0x05: return(12); break;//向右健
148 1 }
149 1 }*/
150 1
151 1 }
152
153 void step_one(void)///实验一 步骤一 显示操作者,测量数据
154 {
155 1 ulong ad;
156 1 //////uchar buf[4]={111,222,51,255};///测试用
157 1 uchar dat[4],n;
158 1 uchar code str1[]={'I'-32,'c'-32,'q'-32,'='-32,'0'-32,'.'-32,'0'-32,'0'-32,'0'-32,'m'-32,'A'-32,0},str2
-[]={'V'-32,'b'-32,'q'-32,'='-32,'0'-32,'.'-32,'0'-32,'0'-32,'0'-32,'V'-32,0};
159 1 uchar code str3[]={'V'-32,'e'-32,'q'-32,'='-32,'0'-32,'.'-32,'0'-32,'0'-32,'0'-32,'V'-32,0},str4[]={'V'
--32,'c'-32,'q'-32,'='-32,'0'-32,'.'-32,'0'-32,'0'-32,'0'-32,'V'-32,0};
160 1 uchar code str0[]={'S'-32,'t'-32,'e'-32,'p'-32,'0'-32,'1'-32,0};
161 1 LcmClear(0);
162 1
163 1 PutData2(9,1,ID2[0]);
164 1 PutChar(12,1,0x03);
165 1 showword(shi, 0x70,0);
166 1 showword(yan,0x80,0);
167 1 showword(tai_2,0x90,0); //显示实验台序号
168 1
169 1 PutString(10,2,str0);
170 1 PutString(0,3,str1);
171 1 ////数据折算Icq
172 1 ad=buf[0];
173 1 ad=ad*5000/255;
174 1 dat[3]=ad%10;
175 1 dat[2]=ad/10%10;
176 1 dat[1]=ad/100%10;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -