提交 | 用户 | age
|
5dd1b7
|
1 |
#include "unibus.h" |
Q |
2 |
#include "stdio.h" |
|
3 |
|
|
4 |
unsigned int idata sendBUF[32],receBUF[32]; |
|
5 |
|
|
6 |
void StartSend(void) |
|
7 |
{ |
|
8 |
|
|
9 |
|
|
10 |
TI = 0; |
|
11 |
SBUF = sendBUF[0]; |
|
12 |
|
|
13 |
} |
|
14 |
|
|
15 |
void ReadData(void) |
|
16 |
{ |
|
17 |
ST = receBUF[]; |
|
18 |
Addr = receBUF[]; |
|
19 |
cmd = receBUF[]; |
|
20 |
len = receBUF[]; |
|
21 |
dat[0] = receBUF[]; |
|
22 |
dat[1] = receBUF[]; |
|
23 |
dat[2] = receBUF[]; |
|
24 |
dat[3] = receBUF[]; |
|
25 |
BCC = receBUF[]; |
|
26 |
ED = receBUF[]; |
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
} |
|
31 |
|
|
32 |
|
|
33 |
/* 判断主从 */ |
|
34 |
void MasterSlave(void) |
|
35 |
{ |
|
36 |
if(MS) |
|
37 |
{ |
|
38 |
MSMode = 1; |
|
39 |
} |
|
40 |
else |
|
41 |
MSMode = 0; |
|
42 |
} |
|
43 |
|
|
44 |
/* 检查是否有数据从主机发送 */ |
|
45 |
bool DataReceived(void) |
|
46 |
{ |
|
47 |
|
|
48 |
} |
|
49 |
/* 接收数据 */ |
|
50 |
unsigned int ReceiveData(void) |
|
51 |
{ |
|
52 |
|
|
53 |
} |
|
54 |
/* 处理接收数据 */ |
|
55 |
void ProcessReceiveData(void) |
|
56 |
{ |
|
57 |
|
|
58 |
} |
|
59 |
/* 判断是否需要向主机回答 */ |
|
60 |
bool ShouldSendData(void) |
|
61 |
{ |
|
62 |
|
|
63 |
} |
|
64 |
/* 准备发送数据 */ |
|
65 |
void PrepareSendData(void) |
|
66 |
{ |
|
67 |
|
|
68 |
} |
|
69 |
/* 发送数据 */ |
|
70 |
|
|
71 |
void SendData() |
|
72 |
{ |
|
73 |
|
|
74 |
} |