static void ProcWrAddr() { Funs485.Rst(addr); Funs485.UnLock(addr); WriteAddrFinish tempDelegate = WrAddrFinish; UInt16 writeVal = (UInt16)(newAddr << 8); writeVal += newAddr; if (Funs485.WriteDebugReg(addr, 0xf0, writeVal)) { addr = newAddr; if (tempDelegate != null) { tempDelegate(new WrAddrFinishEventArgs(true, addr)); } } else { if (tempDelegate != null) { tempDelegate(new WrAddrFinishEventArgs(false, newAddr)); } } }
static public bool UnLock(byte boardAddr) { if (Funs485.WriteDebugReg(boardAddr, (UInt16)0xffff, (UInt16)0x55aa) == false) { return(false); } if (Funs485.WriteDebugReg(boardAddr, (UInt16)0xffff, (UInt16)0xaa55) == false) { return(false); } return(true); }