#ifndef _Wdatacom_c_
#define _Wdatacom_c_
#define MyDef extern
/*************************************************************/
#include "Allconfig.h"
void F_WDateSend(void)
{
if(b_DataSendW)
{
if((g_U8IoSendTimeLW==0)&&(g_U8IoSendTimeHW==0))
{
if(g_U8SendDataW&C_BIT7)// //1
{
g_U8IoSendTimeLW=18;//9
g_U8IoSendTimeHW=6; // 3
}
else
{
g_U8IoSendTimeLW=6;
g_U8IoSendTimeHW=18;
}
g_U8SendDataW <<= 1;
++g_U8SendCntW;
if(g_U8SendCntW==8){g_U8SendDataW=g_U8SendDataGroupW[1];}
else if(g_U8SendCntW==16){g_U8SendDataW=g_U8SendDataGroupW[2];}
else if(g_U8SendCntW==24){g_U8SendDataW=g_U8SendDataGroupW[3];}
else if(g_U8SendCntW==32){g_U8SendDataW=g_U8SendDataGroupW[4];}
else if(g_U8SendCntW==40){g_U8SendDataW=g_U8SendDataGroupW[5];}
if(g_U8SendCntW==49) //5个数据 后结束
{
g_U8IoSendTimeLW=0;
g_U8IoSendTimeHW=64;//// 4 //ms
}
else if(g_U8SendCntW>49)
{
b_DataSendW = 0;
g_U8SendCntW = 0;
g_U8IoSendTimeLW=0;
g_U8IoSendTimeHW=0;
}
}
}
//============================================
/*
没码就高电平
有就先发低
*/
if( g_U8IoSendTimeLW> 0 )
{
g_U8IoSendTimeLW--;
P_Data_OutLW();
}
else if( g_U8IoSendTimeHW> 0 )
{
g_U8IoSendTimeHW--;
P_Data_OutHW();
}
else
{
P_Data_OutHW();
}
}
void F_WDateRec(void)
{
//g_u8DataRecBuff
//先发低,后发高, 9L 3H 0.125为1 3L 9H 0.125为0
//
if(g_u8DataRecOneTW<0xf0)++g_u8DataRecOneTW;////1个位24-3
if(!b_DataRecOKW)
{
if(P_Data_InW())//P_KSdaIn()
{
if(g_u8DataRecHTW<0xf0)++g_u8DataRecHTW;
if((g_u8DataRecHTW>3)&&(g_u8DataRecOneTW>18))//高电压够3次,总长度够18次
{
if(g_u8DataRecOneTW<28) //判一次
{
//F_BellOneON();
if(g_u8DataRecLTW>=12) //高
{
g_u8DataRecBuffRecW |= C_BIT0;
}
else
{
g_u8DataRecBuffRecW &= C_CBIT0;
}
//g_u8DataRecBuffRec<<=1;
g_u8DataRecBuffGroupW[g_U8RecCntW/8]=g_u8DataRecBuffRecW;
g_u8DataRecBuffRecW<<=1;
++g_U8RecCntW;
}
g_u8DataRecLTW=0;
g_u8DataRecOneTW=36;//此付值,为判一次
}
if(g_u8DataRecHTW>=40)////4ms 断要处理一帖数据
{
if(g_U8RecCntW>=72) //9个数据
{
//g_u8DataRecBuff=g_u8DataRecBuffRec;
b_DataRecOKW=1;
}
//if(g_u8DataRecHT>=220)//13.75MS
//{
g_U8RecCntW=0;
//}
g_u8DataRecBuffRecW=0;
//g_u8DataRecCnt=0x80;
}
}
else
{
// F_BuzzKey();
if(g_u8DataRecLTW<0xf0)++g_u8DataRecLTW;
if(g_u8DataRecLTW==2)
{
g_u8DataRecHTW=0;
g_u8DataRecOneTW=0;
}
}
}
}
//显示板发送的数据
//g_u8sendPower /g_u8fanSpeed /g_u8PowerAdj /SUM低8位 /0X5A
//电源板发送的数据
//g_u8errCode /AD_V /AD_PAN /AD_IGBT /AD_current /panCheckCnt/ PPG /SUM低8位 /0XA5
void F_WDateDeal()
{
U16 l_u16SumVal;
U8 l_u8SumVal;
u8 l_u8VolPowerA;
if(b_time10ms)return;
if(b_UrSend05sW)
{
b_UrSend05sW=0;
if(!b_DataSendW)
{
l_u16SumVal=g_u8sendPower;
l_u16SumVal+=g_u8fanSpeed;
l_u16SumVal+=g_u8PowerAdj;
l_u16SumVal+=g_u8SendBuzz; // g_u8SendBuzz=2;
g_U8SendDataGroupW[0]=g_u8sendPower;
g_U8SendDataGroupW[1]=g_u8fanSpeed;
g_U8SendDataGroupW[2]=g_u8PowerAdj;
g_U8SendDataGroupW[3]=g_u8SendBuzz;
g_U8SendDataGroupW[4]=(u8)(l_u16SumVal);
g_U8SendDataGroupW[5]=0X5A;
g_U8SendCntW=0;
g_U8SendDataW=g_U8SendDataGroupW[0];
b_DataSendW=1;
}
}
if(b_DataRecOKW)
{
l_u8SumVal=g_u8DataRecBuffGroupW[0];
l_u8SumVal+=g_u8DataRecBuffGroupW[1];
l_u8SumVal+=g_u8DataRecBuffGroupW[2];
l_u8SumVal+=g_u8DataRecBuffGroupW[3];
l_u8SumVal+=g_u8DataRecBuffGroupW[4];
l_u8SumVal+=g_u8DataRecBuffGroupW[5];
l_u8SumVal+=g_u8DataRecBuffGroupW[6];
//F_BuzzOne();
if((l_u8SumVal==g_u8DataRecBuffGroupW[7])&&(0xa5==g_u8DataRecBuffGroupW[8]))
{
g_u8errCode=g_u8DataRecBuffGroupW[0];
g_u8adv=g_u8DataRecBuffGroupW[1];
g_u8panTemp=g_u8DataRecBuffGroupW[2];
g_u8adg=g_u8DataRecBuffGroupW[3];
g_u8adi=g_u8DataRecBuffGroupW[4];
g_u8PanCheckCnt=g_u8DataRecBuffGroupW[5];
g_u8PPG=g_u8DataRecBuffGroupW[6];
}
b_DataRecOKW=0;
}
}
#endif
评论0