/// <summary> /// Get all data from camera memory. /// </summary> /// <returns></returns> public void GetStatus() { try { sysStatus = BitFun.HexToBitArray(BitFun.ByteToHex(TxRx(0x49)).Substring(0, 2)); TxRx(0x53, 0xe0, 0x01, 0x00); fpgaStatus = BitFun.HexToBitArray(BitFun.ByteToHex(TxRx(0x53, 0xe1, 0x01)).Substring(0, 2)); TxRx(0x53, 0xe0, 0x01, 0xd4); trigMode = BitFun.HexToBitArray(BitFun.ByteToHex(TxRx(0x53, 0xe1, 0x01)).Substring(0, 2)); TxRx(0x53, 0xe0, 0x01, 0xf7); testPattern = BitFun.ByteToHex(TxRx(0x53, 0xe1, 0x01)) == "4"; } catch { } }
/// <summary> /// Init. camera with required settings. /// </summary> private void Initialize() { TxRx(0x4f, 0x52); // Boot the FPGA TxRx(0x4f, 0x57); // Set system state TxRx(0x53, 0xe0, 0x02, 0x00, 0x01); // Set FPGA control register TxRx(0x53, 0xae, 0x05, 0x01, 0x00, 0x00, 0x02, 0x00); string cal = BitFun.ByteToHex(TxRx(0x53, 0xaf, 0x12)).Substring(20, 16); ushort calADC0C = (ushort)BitFun.ByteToInt(BitFun.HexToByte(cal.Substring(0, 4))); ushort calADC40C = (ushort)BitFun.ByteToInt(BitFun.HexToByte(cal.Substring(4, 4))); ushort calDAC0C = (ushort)BitFun.ByteToInt(BitFun.HexToByte(cal.Substring(8, 4))); ushort calDAC40C = (ushort)BitFun.ByteToInt(BitFun.HexToByte(cal.Substring(12, 4))); calibrationADC[0] = -40.0 / Convert.ToDouble(calADC0C - calADC40C); // slope calibrationADC[1] = 40.0 - (calibrationADC[0] * Convert.ToDouble(calADC40C)); // intercept calibrationDAC[0] = -40.0 / Convert.ToDouble(calDAC0C - calDAC40C); // slope calibrationDAC[1] = 40.0 - (calibrationDAC[0] * Convert.ToDouble(calDAC40C)); // intercept GetStatus(); }