CPU card program terminal sends data to ESAM[Copy link]
The terminal sends a byte function to ESAM /****************************************** Function name: EsamSendChar Function: Send a byte to Esam Input parameter: cSendChar, byte to be sent Output parameter: None Description: Send 10 bits, the first bit is the start bit (always low), the 10th bit is the check bit, Send at most 3 times, *******************************************/ void EsamSendChar(unsigned char cSendChar) { unsigned int iTempTran,iErrCoun; unsigned int iTemp=cSendChar; [ size=4] iTemp=iTemp<<1; iTemp=iTemp&(~BIT0); CardWorkFlag=~(ICXOR+MXOR)&CardWorkFlag; PorCheckBit(cSendChar); if(CardWorkFlag&0x80) iTemp=iTemp|BIT9; else iTemp=iTemp&(~BIT9); EsamSDAOutput;[ /size] for(iErrCoun=0;iErrCoun<3;iErrCoun++) { for(iTempTran=0;iTempTran<10;iTempTran++) { if(iTemp&0x01) { EsamSDAOutputHigh; } else[/size ] { EsamSDAOutputLow; } iTemp=iTemp>>0x01; Delay1ETU(); } EsamSDAInput; Delay05XETU(); //Send OK [size =4]if(EsamSDAInputCheck) { Delay1ETU(); Delay05XETU(); goto EsamSendCharOk; [size=4 ] } //Send error else { CardError=ErrorRWBIT|CardError; Delay1 ETU(); EsamSDAOutput; Delay1ETU(); } } EsamSendCharOk:; }