| | |
| | | case WriteCoil: //5 bit |
| | | //Store Datas; |
| | | //SetBitValue(&KMem.WR[Addr1],bitAddr,pPkg->nCount); |
| | | Addr1=(Addr&0xfff0)>>4; |
| | | bitAddr=Addr&0xf; |
| | | if (nCount == 0) // set to 0 |
| | | { |
| | | ResetBit(&KMem.WY[Addr1],bitAddr); |
| | | if (Addr < 2048) { ResetBit(&KMem.WY[Addr1],bitAddr);} |
| | | else {ResetBit(&KMem.WR[Addr1-128],bitAddr);} |
| | | }else if (nCount == 0xFF00) // set to 1 |
| | | { |
| | | SetAddrBit(&KMem.WY[Addr1],bitAddr); |
| | | }else |
| | | { |
| | | //error |
| | | if (Addr < 2048) { SetAddrBit(&KMem.WY[Addr1],bitAddr);} |
| | | else {SetAddrBit(&KMem.WR[Addr1-128],bitAddr);} |
| | | |
| | | } |
| | | memcpy(Pkgbuf,ptr,len); |
| | | needcrc=0; |