/*===========================
// 串口1发送字节函数
//==========================*/
void S1_SendData(unsigned char dat)
{
ACC = dat;
if(P)
{
TB8 = 1;
}
else
{
TB8 = 0;
}
SBUF = ACC;
while(!TI);
TI = 0;
}
/*/*************************************************************************************
//发送的指令
//69 FF 69 FF FE FE FE FE 68 01 06 00 00 00 00 68 C9 00 A0 16
//*************************************************************************************/
void FS_0106_QG_XCDW_out(void) //发送指令
{
unsigned char tx_buf[10]={0x68,0x01,0x06,0x00,0x00,0x00,0x00,0x68,0xC9,0x00};
unsigned char l,TEMdata;
unsigned char SUM0 = 0;
for(l=0;l<2;l++)
{
S1_SendData(0x69);
S1_SendData(0xFF);
}
for(l=0;l<4;l++)
{
S1_SendData(0xFE);
}
for(l=0;l<10;l++)
{
TEMdata = tx_buf[0+l];
SUM0 += TEMdata;
S1_SendData(TEMdata);
}
S1_SendData(SUM0);
S1_SendData(0x16);
}
给你一个我项目中用的发送指令参考,项目用很多,绝对可以 |