📄 mt888.lst
字号:
C51 COMPILER V7.06 MT888 02/06/2009 11:22:07 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE MT888
OBJECT MODULE PLACED IN MT888.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE MT888.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 #include "AT89X52.h"
2 #include "MT888.h"
3 #include "stdio.h"
4
5 #define RS_MT P1_7
6 #define RD_MT P1_6
7 #define WR_MT P1_5
8
9 #define D0 P3_7
10 #define D1 P3_6
11 #define D2 P3_5
12 #define D3 P3_4
13
14 char bdata MT_Read;
15 sbit TFinished = MT_Read^1;
16 sbit DRecieved = MT_Read^2;
17
18 unsigned char Digit;
19 /////////////////////////////////////////////////////////////////
20 // ////////
21 ////////////////////////////////////////////////////////////////
22
23 void write_data_transmit(unsigned char dat)
24 {
25 1 if(dat&0x01==1) D0 = 1;
26 1 else D0 = 0;
27 1 if((dat>>1)&0x01==1) D1 = 1;
28 1 else D1 = 0;
29 1 if((dat>>2)&0x01==1) D2 = 1;
30 1 else D2 = 0;
31 1 if((dat>>3)&0x01 ==1) D3 = 1;
32 1 else D3 = 0;
33 1 RS_MT = 0;
34 1 RD_MT = 1;
35 1 WR_MT = 0;
36 1 WR_MT =1;
37 1 }
38
39 unsigned char read_data_reg()
40 {
41 1 unsigned char dat;
42 1 D0 = 1;
43 1 D1 = 1;
44 1 D2 = 1;
45 1 D3 = 1;
46 1 RS_MT = 0;
47 1 WR_MT = 1;
48 1 RD_MT = 0;
49 1 dat = 0x00;
50 1 if(D0 == 1) dat = dat|0x01;
51 1 if(D1 == 1) dat = dat|0x02;
52 1 if(D2 == 1) dat = dat|0x04;
53 1 if(D3 == 1) dat = dat|0x08;
54 1 RD_MT = 1;
55 1 return dat;
C51 COMPILER V7.06 MT888 02/06/2009 11:22:07 PAGE 2
56 1
57 1 }
58
59 void write_control_reg(unsigned char dat)
60 {
61 1 if(dat&0x01==1) D0 = 1;
62 1 else D0 = 0;
63 1 if((dat>>1)&0x01==1) D1 = 1;
64 1 else D1 = 0;
65 1 if((dat>>2)&0x01==1) D2 = 1;
66 1 else D2 = 0;
67 1 if((dat>>3)&0x01 ==1) D3 = 1;
68 1 else D3 = 0;
69 1 RS_MT = 1;
70 1 RD_MT = 1;
71 1 WR_MT = 0;
72 1 WR_MT = 1;
73 1 }
74
75 unsigned char read_status_reg()
76 {
77 1 unsigned char dat;
78 1 D0 = 1;
79 1 D1 = 1;
80 1 D2 = 1;
81 1 D3 = 1;
82 1 RS_MT = 1;
83 1 WR_MT = 1;
84 1 RD_MT = 0;
85 1 dat=0x00;
86 1 if(D0 ==1) dat=dat|0x01;
87 1 if(D1 ==1) dat=dat|0x02;
88 1 if(D2 ==1) dat=dat|0x04;
89 1 if(D3 ==1) dat=dat|0x08;
90 1
91 1 RD_MT = 1;
92 1 return dat;
93 1
94 1 }
95
96 void initMT8888(void)
97 {
98 1
99 1 read_status_reg();
100 1 write_control_reg(0);
101 1 write_control_reg(0);
102 1 write_control_reg(8);
103 1 write_control_reg(0);
104 1 read_status_reg();
105 1
106 1 }
107 void setupMT8888(void)
108 {
109 1
110 1 write_control_reg(13);
111 1 write_control_reg(0);
112 1 }
113
114 void TransmitDTMF(unsigned char digit)
115 {
116 1 write_data_transmit(digit);
117 1 do
C51 COMPILER V7.06 MT888 02/06/2009 11:22:07 PAGE 3
118 1 {
119 2 MT_Read = 0x00;
120 2 MT_Read = read_status_reg();
121 2
122 2 }
123 1 while (TFinished==0);
124 1 }
125
126 unsigned char ReceiveDTMF()
127 {
128 1 MT_Read = 0x00;
129 1 MT_Read = read_status_reg();
130 1 while(MT_Read^2==1)
131 1 {
132 2 Digit = read_data_reg();
133 2 MT_Read = read_status_reg();
134 2 }
135 1 Digit =Digit&0x0f; // b? nible cao v
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -