Example #1
0
        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));
                }
            }
        }
Example #2
0
        static void ProcRdAddrAddr()
        {
            Funs485.Rst(255);
            Funs485.UnLock(255);
            ReadAddrFinish tempResult = RdAddrFinish;
            UInt16         outVal;

            if (Funs485.ReadDebugReg(255, 0xf0, out outVal))
            {
                addr = (byte)outVal;
                if (tempResult != null)
                {
                    tempResult(new ReadAddrFinishEventArgs(true, addr));
                }
            }
            else
            {
                if (tempResult != null)
                {
                    tempResult(new ReadAddrFinishEventArgs(false, addr));
                }
            }
        }