コード例 #1
0
        private int GetADCRegisterData()
        {
            //Shift MSB to the left 8 bits)
            int RTDVala = GetRegister(0x01) << 8;
            int RTDValb = GetRegister(0x02);

            if ((GetRegister(0x02) & 0x01) > 0)
            {
                FaultEvent?.Invoke(this, GetRegister((byte)Register.FLT_STATUS));
            }
            //FaultEvent(this, );
            //Merge bytes
            return(RTDVala | RTDValb);
        }
コード例 #2
0
        /// <summary>
        /// Run an automatic fault scan
        /// </summary>
        public void RunAutoFltScan()
        {
            byte OldValue = GetRegister(0x00);
            //Write 100x010x by keeping existing values for ...x...x and adding 0x84
            byte NewValue = (byte)((OldValue & 0x11) | 0x84); //Everything by D5,D3 and D2...plus the falut clear bit

            Debug.WriteLine("Run Fault Scan: Old:" + OldValue.ToString("X") + " New:" + NewValue.ToString("X"));

            SetRegister(0x00, NewValue);
            while ((GetRegister(0x00) & 0x0C) > 0)
            {
                ;
            }
            byte FaultByte = GetRegister((byte)Register.FLT_STATUS);

            if (FaultByte > 0)
            {
                FaultEvent?.Invoke(this, FaultByte);
            }
        }