Advertisement

CPU卡程序设计实例二十 8字节随机数读取

阅读量:

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

函数名称:Get_RandNum

函数功能:从卡或ESAM中获取8字节长度的随机数数据

输入参数:无

输出参数:*pcRandBuff

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

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

unsigned char *Get_RandNum(void)

{

unsigned char cRandBuff[10]={0};

unsigned char *pcRandBuff;

unsigned int itemp;

cCommandLen=0x05;

TxAndRxBuff[0]=0x00;

TxAndRxBuff[1]=0x84;

TxAndRxBuff[2]=0x00;

TxAndRxBuff[3]=0x00;

TxAndRxBuff[4]=0x08;

SendCommandHead_Pro();

if(CardORESAM&CardWorkFlag)

{

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

{

cRandBuff[itemp]=CardReceChar();

if(ErrorR

全部评论 (0)

还没有任何评论哟~