public double[] ReadRSSI()
        {
            double[] rssi = new double[MAX_CHANNEL];
            for (int i = 0; i < MAX_CHANNEL; i++)
            {
                byte Page = byte.Parse((0x81 + i).ToString());
                inst_ABB.SelectPage(SlaveAdd, Page);
                byte Data1 = inst_ABB.I2CMasterSingleReadModule(SlaveAdd, 0x92);
                byte Data2 = inst_ABB.I2CMasterSingleReadModule(SlaveAdd, 0x93);
                rssi[i] = Convert.ToDouble(Data1 * 256 + Data2);
            }

            return(rssi);
        }
예제 #2
0
        public double [] ReadPower()
        {
            UInt16[] ResultRSSI = new UInt16[4];
            for (int i = 0; i < 4; i++)
            {
                byte Page = byte.Parse((0x81 + i).ToString());
                inst_ABB.SelectPage(SlaveAdd, Page);
                byte Data1 = inst_ABB.I2CMasterSingleReadModule(SlaveAdd, 0x92);
                byte Data2 = inst_ABB.I2CMasterSingleReadModule(SlaveAdd, 0x93);
                ResultRSSI[i] = UInt16.Parse((Data1 * 256 + Data2).ToString());
            }


            double[] Resp = new double[4];

            for (int i = 0; i < 4; i++)
            {
                double Power = Math.Pow(10, referencePower[i] / 10);
                Resp[i] = (double)(ResultRSSI[i]) / 4096.0 * 2.5 / 6.4 * 32;
                Resp[i] = Math.Round(Resp[i] / Power, 2);
            }
            return(Resp);
        }