예제 #1
0
        public float CardPoll() //use this method for getting data
        {
            ushort Jump20v = 0;
            ushort Bipolar = 0; //1-yes, 0-no

            float result = PISO813.AD_Float(_config.AddressBase, Jump20v, Bipolar);

            //should return -10 10, value scaled according to SetChGain
            if (result == -100)
            {
                throw new ApplicationException("a/d converter failed");
            }

            return(result);
        }
예제 #2
0
        public ListenerBoard(int boardNo)
        {
            BoardNo = boardNo;

            var result = PISO813.DriverInit();

            //expected errors list

            if (result != 0)
            {
                throw new ApplicationException("Error initializing driver");
            }

            CardSearch();

            _config = GetConfigAddressSpace();
        }
예제 #3
0
        //physical card address required 813-board 0 da2-board 1

        private ConfigAddress GetConfigAddressSpace() //getting card charasteristics and prepping for activation
        {
//            var boardId = CardSearch();


            var result = PISO813.GetConfigAddressSpace(Convert.ToUInt16(BoardNo), out uint addrBase, out ushort irqNo, out ushort subVendor, out ushort subDevice, out ushort subAux, out ushort slotBus, out ushort slotDevice);


            if (result != 0)
            {
                throw new ApplicationException($"Get Address failed, probably invalid BoardNo {result}");
            }

            var config = new ConfigAddress()
            {
                AddressBase = addrBase,
                IrqNo       = irqNo,
                SubVendor   = subVendor,
                SubDevice   = subDevice,
                SubAux      = subAux,
                SlotBus     = slotBus,
                SlotDevice  = slotDevice
            };

            //portreset

            PISO813.OutputByte((ushort)addrBase, 1);  //channel reset?


            ushort Channel = 0;                      //hardware requirement

            PISO813.SetChGain(addrBase, Channel, 0); //unipolar jp1 5v jp2 10v


            return(config);
        }
예제 #4
0
 public void Dispose() //mechanism for releasing resources
 {
     PISO813.DriverClose();
 }