Advertisement

CPU卡程序设计实例21读取4字节随机数

阅读量:

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

函数名称:Get_RandNum4Byte

函数功能:从卡片或ESAM模块获取4字节长度的随机数值

输入参数:无

输出参数:*pcRandBuff

描述:在发送命令头之后,当接收到的数据与命令头中的第二字节相匹配时,随后的4个字节内容即为所获取的随机数值

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

unsigned char *Get_RandNum4Byte(void)

{

unsigned char cRandBuff[6]={0};

unsigned char *pcRandBuff;

unsigned int itemp;

cCommandLen=0x05;

TxAndRxBuff[0]=0x00;

TxAndRxBuff[1]=0x84;

TxAndRxBuff[2]=0x00;

TxAndRxBuff[3]=0x00;

TxAndRxBuff[4]=0x04;

SendCommandHead_Pro();

if(CardORESAM&CardWorkFlag)

{

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

{

cRandBuff[itemp]=CardReceChar();

全部评论 (0)

还没有任何评论哟~