📄 task.c
字号:
/* ---------------------------------- File Description --------------------------------------------
【文件功能】:
【创建时间】:2008年10月15日9:24:34
【文件版本】:V1.0
【作者声明】:本文件作者为温业中,可通过email与作者联系: eric540@163.com
------------------------------------------------------------------------------------------ */
#include"type.h"
#include"can.h"
#include "task.h"
#define Master_ID 0x02
#define Self_ID 0x00
CAN_MSG MsgBuf_TX1, MsgBuf_TX2;
BYTE DispBuf[65];
int DispFramOver=FALSE;
CAN_MSG MsgBuf_RX1, MsgBuf_RX2;
/*---- S E N D _ K E Y ----
【功能】:发送键盘码给主机
【参数】:键盘码
****
【返回】:****
【说明】:****
--------------作者:温业中 2008年10月15日9:22:40--------------------------------*/
void send_key(DWORD key_value)
{
DWORD ID_dat;
ID_dat='K';
ID_dat<<=16;
ID_dat|=(Master_ID<<8)|(Self_ID);
MsgBuf_TX1.Frame = 0x80080000; // 29-bit, no RTR, DLC is 8 bytes
MsgBuf_TX1.MsgID = ID_dat; // CAN ID
MsgBuf_TX1.DataA = (0x01<<24)|(key_value<<16)|0x0000;
MsgBuf_TX1.DataB = 0x00000000;
while(CAN1_SendMessage(&MsgBuf_TX1)==FALSE);
}
void send_CardDat(void)
{
}
/*---- R E C E I V E _ D I S P D A T ----
【功能】:接收主机显示数据到缓存中
【参数】:
****
【返回】:****
【说明】:****
--------------作者:温业中 2008年10月15日9:24:02--------------------------------*/
void Receive_DispDat(void)
{
int addr;
if((MsgBuf_RX1.MsgID>>16)=='D')
{
addr=(MsgBuf_RX1.DataA>>8)&0xff;
*((WORD*)(DispBuf+addr))=(MsgBuf_RX1.DataA>>16);
*((DWORD*)(DispBuf+addr+2))=MsgBuf_RX1.DataB;
if(addr==60)
DispFramOver=TRUE;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -