📄 main.lst
字号:
C51 COMPILER V6.12 MAIN 01/24/2006 09:00:57 PAGE 1
C51 COMPILER V6.12, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Manley\c51\BIN\C51.EXE main.c DB OE SMALL ROM(LARGE)
stmt level source
1 #include <main.h>
2 #include <com.h>
3 sbit ctr_bc = P1^5 ;
4 sbit SEND485 = P1^0;
5
6 bit fctr_len = TRUE;
7 word pre_ctr_len = NULL_WORD;
8 word pre_ctr_num = NULL_WORD;
9 byte ctr_num = NULL_BYTE;
10 byte xdata ctr_data[INF_R_BUFF_LEN];//片外数据存储(16bit)
11
12 byte bdata err_reg = NULL_BYTE;//片内可位寻址的RAM空间(16byte)
13
14 byte xdata *x = 0x0000;
15
16 void init_mcu(void)
17 {
18 1 TMOD = 0x21; //设置9600波特率的T1采用方式2,T0采用方式1,为16位定时器//
19 1 SCON = 0x50;//
20 1 PCON = 0x00;
21 1 ES = 1;//开串口中断
22 1 EX0=1;//允许外部中断0
23 1 EX1=1;//允许外部中断1
24 1 TH1 = 0xfd;
25 1 TL1 = 0xfd;//9600波特率
26 1 TH0 = 0xd8;
27 1 TL0 = 0xef;//9600波特率
28 1 IT0 = 1;//外部中断0采用边沿触发
29 1 IT1 = 1;//外部中断1采用边沿触发
30 1 ET0 = 1;
31 1 TR0 = 1;
32 1 TR1 = 1;
33 1 PS = 1; //串行口为高级中断
34 1 PX1 = 1; //外部中断1为高级中断
35 1 EA= 1 ;
36 1 TI = 0; //串口无发送中断
37 1 }
38
39
40
41 void init_gct(void)
42 {
43 1 ctr_bc = 1;
44 1 }
45
46 void prc_ctr(void)
47 {
48 1
49 1 switch(ctr_data[0])
50 1 {
51 2 case 0x0a://司机室停止与乘客通话
52 2 if(ctr_data[1] == 0x01)
53 2 {
54 3 ctr_bc = 0;
55 3 }
C51 COMPILER V6.12 MAIN 01/24/2006 09:00:57 PAGE 2
56 2 else if(ctr_data[1] == 0x00)
57 2 {
58 3 ctr_bc = 1;
59 3 }
60 2 break;
61 2 default:break;
62 2 }
63 1 }
64
65 void chk_send_empty(void)
66 {
67 1 if(pcom_send_buff_rd == com_s_buff + COM_S_BUFF_LEN)
68 1 {
69 2 if(pcom_send_buff_wr == com_s_buff)
70 2 com_send_buff_empty = TRUE;//rd指针读到fifo末尾时,写指针在fifo开头位置,则fifo为空
71 2 pcom_send_buff_rd = com_s_buff;//把rd指针移到fifo开头位置
72 2 }
73 1 else
74 1 {
75 2 pcom_send_buff_rd++;
76 2 if(pcom_send_buff_wr == pcom_send_buff_rd)
77 2 com_send_buff_empty = TRUE;//若rd指针在fifo中间,当prc指针加1后与写指针相等,则fifo也为空
78 2 }
79 1 }
80
81 void main(void)
82 {
83 1 byte tmp;
84 1 init_gct();
85 1 init_mcu();
86 1 init_timer();
87 1 init_com();
88 1 init_max3100();
89 1 while(TRUE)
90 1 {
91 2 if(!com_r_buff_empty)
92 2 com_r_prc();
93 2 if(!com_send_buff_empty)
94 2 {
95 3 tmp = *pcom_send_buff_rd;
96 3 max3100_senddata(tmp);
97 3 chk_send_empty();
98 3 }
99 2 while(!inf_r_buff_empty)
100 2 {
101 3 if(inf_r_total)
102 3 {
103 4 if(fctr_len)
104 4 {
105 5 fctr_len = FALSE;
106 5 w_b.b.l = get_inf_r_data();
107 5 w_b.b.h = get_inf_r_data();
108 5 pre_ctr_len = w_b.w;
109 5 }
110 4 else
111 4 {
112 5 ctr_data[pre_ctr_num] = get_inf_r_data();
113 5 pre_ctr_num++;
114 5 if(pre_ctr_num == pre_ctr_len)
115 5 {
116 6 pre_ctr_num = NULL_BYTE;
117 6 inf_r_total--;
C51 COMPILER V6.12 MAIN 01/24/2006 09:00:57 PAGE 3
118 6 fctr_len = TRUE;
119 6 ctr_num++;
120 6 prc_ctr();
121 6 }
122 5 }
123 4 }
124 3 }
125 2 }
126 1
127 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 241 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 4096 ----
PDATA SIZE = ---- ----
DATA SIZE = 8 ----
IDATA SIZE = ---- ----
BIT SIZE = 1 ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -