您的位置 首页 > 爱车一族

出口参数——函数的出口参数…

1、终端向ESAM发送一个字节函数

/**************************************

函数名称:EsamSendChar

函数功能:向Esam发送一个字节

入口参数:cSendChar,要发送的字节

出口参数:无

描述:发送10位,第一位起始位(始终为低),第10位是校验位,

最多发3次,

***************************************/

void EsamSendChar(unsigned char cSendChar)

{

unsigned int iTempTran,iErrCoun;

unsigned int iTemp=cSendChar;

iTemp=iTemp<<1;

iTemp=iTemp&(~BIT0);

CardWorkFlag=~(ICXOR+MXOR)&CardWorkFlag;

PorCheckBit(cSendChar);

if(CardWorkFlag&0x80) iTemp=iTemp|BIT9;

else iTemp=iTemp&(~BIT9);

EsamSDAOutput;

for(iErrCoun=0;iErrCoun<3;iErrCoun++)

{

for(iTempTran=0;iTempTran<10;iTempTran++)

{

if(iTemp&0x01)

{

EsamSDAOutputHigh;

}

else

{

EsamSDAOutputLow;

}

iTemp=iTemp>>0x01;

Delay1ETU();

}

EsamSDAInput;

Delay05XETU();

//发送OK

if(EsamSDAInputCheck)

{

Delay1ETU();

Delay05XETU();

goto EsamSendCharOk;

}

//发送错误

else

{

CardError=ErrorRWBIT|CardError;

Delay1ETU();

EsamSDAOutput;

Delay1ETU();

}

}

EsamSendCharOk:;

}

2、终端向CPU卡发送一个字节函数

/**************************************

函数名称:CardSendChar

函数功能:向CPU卡发送一字节

入口参数:cSendChar,要发送的字节

出口参数:无

描述:发送10位,第一位起始位(始终为低),第10位是校验位,

最多发3次,

***************************************/

void CardSendChar(unsigned char cSendChar)

{

unsigned int iTempTran,iErrCoun;

unsigned int iTemp=cSendChar;

iTemp=iTemp

<<1;

iTemp=iTemp&(~BIT0);

//清除校验位,然后计算校验位

CardWorkFlag=~(ICXOR+MXOR)&CardWorkFlag;

PorCheckBit(cSendChar);

if(CardWorkFlag&0x80) iTemp=iTemp|BIT9;

else iTemp=iTemp&(~BIT9);

//开始数据发送

CardSDAOutput;

for(iErrCoun=0;iErrCoun<3;iErrCoun++)

{

//发送1个字节,8位

for(iTempTran=0;iTempTran<10;iTempTran++)

{

if(iTemp&0x01)

{

CardSDAOutputHigh;

}

else

{

CardSDAOutputLow;

}

iTemp=iTemp>>0x01;

Delay1ETU();

}

CardSDAInput;

Delay05XETU();

//发送OK

if(CardSDAInputCheck)

{

Delay1ETU();

Delay05XETU();

goto SendCharOk;

}

//发送错误

else

{

CardError=ErrorRWBIT|CardError;

Delay1ETU();

CardSDAOutput;

Delay1ETU();

}

}

SendCharOk:;

}

3、待发送字节的偶校验生成函数

/**************************************

函数名称:PorCheckBit

函数功能:计算待发送字符的偶校验

输入参数:cSendChar,要发送的字符

输出参数:无

描述:生成偶校验位

**************************************/

void PorCheckBit(unsigned char cSendChar)

{

unsigned char SendCommandBufBit=cSendChar;

int itemp;

for(itemp=0;itemp<8;itemp++)

{

if(SendCommandBufBit&0x01)

{

CardWorkFlag=CardWorkFlag^0x80;

}

SendCommandBufBit=SendCommandBufBit>>0x01;

}

}

责任编辑: 鲁达

1.内容基于多重复合算法人工智能语言模型创作,旨在以深度学习研究为目的传播信息知识,内容观点与本网站无关,反馈举报请
2.仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证;
3.本站属于非营利性站点无毒无广告,请读者放心使用!

“出口参数,函数的出口参数,入口参数和出口参数,微机原理入口参数和出口参数,出口参数是什么”边界阅读