输入条件:SysKind=0--->EasmChip的操作,SysKind=1-->CpuCard的操作,SendBuf--->待发送的数据。
输出项目:无。EasmChip
void CosSend(bool SysKind,unsigned char SendBuf) { Even = 0; Test = 0; WDT(); SysErrInfo = 0x00; Delay10etu(); //1etu if(SysKind) { WDT(); Even = 0; CpuCardSdaDirOut;//CARD_IO_DDR = 1;output CpuCardSdaLow;//CARD_IO = 0;start Bit=0 Test=0; Test=0; Test=0; Test=0; Test >>= 1; Delay10etu();//1etu _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); for(Bits = 0; Bits < 8; Bits++) { if((SendBuf & 0x01) == 0x01) { Even =~Even; CpuCardSdaHig; //CARD_IO = 1; } else { Test = ~Test; CpuCardSdaLow; //CARD_IO = 0; } SendBuf >>= 1; Delay10etu(); //1etu _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); } if(Even) { CpuCardSdaHig; //CARD_IO = 1 } else { CpuCardSdaLow; //CARD_IO = 0 } Delay10etu(); //1etu _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); CpuCardSdaHig; //CARD_IO_DIR = 0;input Delay10etu(); //1etu _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); } else { WDT(); Even = 0; EasmChipSdaDirOut;//CARD_IO_DDR = 1;output EasmChipSdaLow;//CARD_IO = 0;start Bit=0 Test=0; Test=0; Test=0; Test=0; Test >>= 1; Delay10etu();//1etu _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); for(Bits = 0; Bits < 8; Bits++) { if((SendBuf & 0x01) == 0x01) { Even =~Even; EasmChipSdaHig; //CARD_IO = 1; } else { Test = ~Test; EasmChipSdaLow; //CARD_IO = 0; } SendBuf >>= 1; Delay10etu(); //1etu _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); } if(Even) { EasmChipSdaHig; //CARD_IO = 1 } else { EasmChipSdaLow; //CARD_IO = 0 } Delay10etu(); //1etu _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); EasmChipSdaHig; //CARD_IO_DIR = 0;input Delay10etu(); //1etu _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); _NOP(); } }