Пример #1
0
        public static void Init()
        {
            uint[] auiFirewireInterfaces = new uint[MAX_INTERFACE_COUNT];
            uint[] auiResolutions        = new uint[MAX_RESOULUTIONS];
            uint   uiShutterTime         = 11;
            uint   uiIdleTime            = 900;

            m_hLLT         = 0;
            m_uiResolution = 0;


            m_hLLT = CLLTI.CreateLLTDevice(CLLTI.TInterfaceType.INTF_TYPE_ETHERNET);
            CLLTI.SetDeviceInterface(m_hLLT, 3232240897, 0);
            CLLTI.Connect(m_hLLT);


            uint t = 0;

            //Console.WriteLine("FFFFFFFFFFFFFF");
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_MEASURINGFIELD, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_MEASURINGFIELD, t);
            //Console.WriteLine(t);


            Type tt  = typeof(CLLTI);
            var  mas = tt.GetFields();

            foreach (var item in mas)
            {
                if (item.Name.Contains("FEATURE") || item.Name.Contains("INQUIRY"))
                {
                    FieldInfo fi         = typeof(CLLTI).GetField(item.Name);
                    object    fieldValue = fi.GetValue(t);
                    CLLTI.GetFeature(m_hLLT, (uint)fieldValue, ref t);
                    CLLTI.SetFeature(m_hLLT, (uint)fieldValue, t);
                    //Console.WriteLine($"{item.Name}");
                }
                //Console.WriteLine($"{item.Name}");
            }

            //Console.WriteLine("FFFFFFFFFFFFFF");
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_LASERPOWER, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_LASERPOWER, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_MEASURINGFIELD, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_MEASURINGFIELD, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_TRIGGER, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_TRIGGER, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SHUTTERTIME, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SHUTTERTIME, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_IDLETIME, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_IDLETIME, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_PROCESSING_PROFILEDATA, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_PROCESSING_PROFILEDATA, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_THRESHOLD, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_THRESHOLD, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_MAINTENANCEFUNCTIONS, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_MAINTENANCEFUNCTIONS, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_ANALOGFREQUENCY, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_ANALOGFREQUENCY, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_ANALOGOUTPUTMODES, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_ANALOGOUTPUTMODES, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_CMMTRIGGER, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_CMMTRIGGER, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_REARRANGEMENT_PROFILE, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_REARRANGEMENT_PROFILE, t);
            // Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_PROFILE_FILTER, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_PROFILE_FILTER, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_RS422_INTERFACE_FUNCTION, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_RS422_INTERFACE_FUNCTION, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SATURATION, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SATURATION, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_TEMPERATURE, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_TEMPERATURE, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_CAPTURE_QUALITY, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_CAPTURE_QUALITY, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SHARPNESS, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SHARPNESS, t);
            //Console.WriteLine(t);



            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_LASERPOWER, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_LASERPOWER, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_MEASURINGFIELD, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_MEASURINGFIELD, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_TRIGGER, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_TRIGGER, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_SHUTTERTIME, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_SHUTTERTIME, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_IDLETIME, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_IDLETIME, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_PROCESSING_PROFILEDATA, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_PROCESSING_PROFILEDATA, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_THRESHOLD, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_THRESHOLD, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_MAINTENANCEFUNCTIONS, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_MAINTENANCEFUNCTIONS, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_ANALOGFREQUENCY, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_ANALOGFREQUENCY, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_ANALOGOUTPUTMODES, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_ANALOGOUTPUTMODES, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_CMMTRIGGER, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_CMMTRIGGER, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_REARRANGEMENT_PROFILE, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_REARRANGEMENT_PROFILE, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_PROFILE_FILTER, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_PROFILE_FILTER, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_RS422_INTERFACE_FUNCTION, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_RS422_INTERFACE_FUNCTION, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_SATURATION, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_SATURATION, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_TEMPERATURE, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_TEMPERATURE, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_CAPTURE_QUALITY, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_CAPTURE_QUALITY, t);
            //Console.WriteLine(t);
            //CLLTI.GetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_SHARPNESS, ref t);
            //CLLTI.SetFeature(m_hLLT, CLLTI.INQUIRY_FUNCTION_SHARPNESS, t);
            //Console.WriteLine(t);


            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SERIAL, 214020058);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_LASERPOWER, 2);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_MEASURINGFIELD, 0);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_TRIGGER, 16777316);      //0
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SHUTTERTIME, 1);  //1
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_IDLETIME, 3900);  //3999
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_PROCESSING_PROFILEDATA, 623);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_THRESHOLD, 3200);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_MAINTENANCEFUNCTIONS, 2);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_ANALOGFREQUENCY, 2);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_ANALOGOUTPUTMODES, 2);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_CMMTRIGGER, 0);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_REARRANGEMENT_PROFILE, 2149096449);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_PROFILE_FILTER, 0);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_RS422_INTERFACE_FUNCTION, 4);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SATURATION, 4);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_TEMPERATURE, 3034);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_CAPTURE_QUALITY, 3034);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SHARPNESS, 0);
            //// CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_MEASURINGFIELD, 0);


            CLLTI.GetLLTType(m_hLLT, ref m_tscanCONTROLType);
            CLLTI.GetResolutions(m_hLLT, auiResolutions, auiResolutions.GetLength(0));

            m_uiResolution = auiResolutions[0];

            CLLTI.SetResolution(m_hLLT, m_uiResolution);
            CLLTI.SetProfileConfig(m_hLLT, CLLTI.TProfileConfig.PROFILE);

            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SHUTTERTIME, uiShutterTime);
            //CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_IDLETIME, uiIdleTime);



            //ushort start_z = 20000;
            //ushort size_z = 25000;
            //ushort start_x = 20000;
            //ushort size_x = 25000;
            //WriteCommand(0, 0); // Reset
            //WriteCommand(0, 0); // Initialization
            //WriteCommand(2, 8); // Navigate in register
            //WriteValue2Register(start_z);
            //WriteValue2Register(size_z);
            //WriteValue2Register(start_x);
            //WriteValue2Register(size_x);
            // WriteCommand(0, 0); // Stop writing process
        }
Пример #2
0
        public static void scanCONTROL_Sample()
        {
            uint[] auiInterfaces  = new uint[MAX_INTERFACE_COUNT];
            uint[] auiResolutions = new uint[MAX_RESOULUTIONS];

            StringBuilder sbDevName = new StringBuilder(100);
            StringBuilder sbVenName = new StringBuilder(100);

            uint uiBufferCount = 20, uiMainReflection = 0, uiPacketSize = 1024;

            int iInterfaceCount = 0;

            int            iRetValue;
            bool           bOK        = true;
            bool           bConnected = false;
            ConsoleKeyInfo cki;

            m_hLLT         = 0;
            m_uiResolution = 0;

            Console.WriteLine("----- Connect to scanCONTROL -----\n");

            //Create a Ethernet Device -> returns handle to LLT device
            m_hLLT = CLLTI.CreateLLTDevice(CLLTI.TInterfaceType.INTF_TYPE_ETHERNET);
            if (m_hLLT != 0)
            {
                Console.WriteLine("CreateLLTDevice OK");
            }
            else
            {
                Console.WriteLine("Error during CreateLLTDevice\n");
            }

            // Get the available interfaces from the scanCONTROL-device
            iInterfaceCount = 1;
            if (iInterfaceCount <= 0)
            {
                Console.WriteLine("FAST: There is no scanCONTROL connected");
            }
            else if (iInterfaceCount == 1)
            {
                Console.WriteLine("FAST: There is 1 scanCONTROL connected ");
            }
            else
            {
                Console.WriteLine("FAST: There are " + iInterfaceCount + " scanCONTROL's connected");
            }

            if (iInterfaceCount >= 1)
            {
                uint target4 = auiInterfaces[0] & 0x000000FF;
                uint target3 = (auiInterfaces[0] & 0x0000FF00) >> 8;
                uint target2 = (auiInterfaces[0] & 0x00FF0000) >> 16;
                uint target1 = (auiInterfaces[0] & 0xFF000000) >> 24;

                // Set the first IP address detected by GetDeviceInterfacesFast to handle
                Console.WriteLine("Select the device interface: " + target1 + "." + target2 + "." + target3 + "." + target4);
                if ((iRetValue = CLLTI.SetDeviceInterface(m_hLLT, auiInterfaces[0], 0)) < CLLTI.GENERAL_FUNCTION_OK)
                {
                    OnError("Error during SetDeviceInterface", iRetValue);
                    bOK = false;
                }

                if (bOK)
                {
                    // Connect to sensor with the device interface set before
                    Console.WriteLine("Connecting to scanCONTROL");
                    if ((iRetValue = CLLTI.Connect(m_hLLT)) < CLLTI.GENERAL_FUNCTION_OK)
                    {
                        OnError("Error during Connect", iRetValue);
                        bOK = false;
                    }
                    else
                    {
                        bConnected = true;
                    }
                }



                if (bOK)
                {
                    // Get the scanCONTROL type and check if it is valid
                    Console.WriteLine("Get scanCONTROL type");
                    if ((iRetValue = CLLTI.GetLLTType(m_hLLT, ref m_tscanCONTROLType)) < CLLTI.GENERAL_FUNCTION_OK)
                    {
                        OnError("Error during GetLLTType", iRetValue);
                        bOK = false;
                    }

                    if (iRetValue == CLLTI.GENERAL_FUNCTION_DEVICE_NAME_NOT_SUPPORTED)
                    {
                        Console.WriteLine(" - Can't decode scanCONTROL type. Please contact Micro-Epsilon for a newer version of the LLT.dll.");
                    }

                    if (m_tscanCONTROLType >= CLLTI.TScannerType.scanCONTROL28xx_25 && m_tscanCONTROLType <= CLLTI.TScannerType.scanCONTROL28xx_xxx)
                    {
                        Console.WriteLine(" - The scanCONTROL is a scanCONTROL28xx");
                    }
                    else if (m_tscanCONTROLType >= CLLTI.TScannerType.scanCONTROL27xx_25 && m_tscanCONTROLType <= CLLTI.TScannerType.scanCONTROL27xx_xxx)
                    {
                        Console.WriteLine(" - The scanCONTROL is a scanCONTROL27xx");
                    }
                    else if (m_tscanCONTROLType >= CLLTI.TScannerType.scanCONTROL26xx_25 && m_tscanCONTROLType <= CLLTI.TScannerType.scanCONTROL26xx_xxx)
                    {
                        Console.WriteLine(" - The scanCONTROL is a scanCONTROL26xx");
                    }
                    else if (m_tscanCONTROLType >= CLLTI.TScannerType.scanCONTROL29xx_25 && m_tscanCONTROLType <= CLLTI.TScannerType.scanCONTROL29xx_xxx)
                    {
                        Console.WriteLine(" - The scanCONTROL is a scanCONTROL29xx");
                    }
                    else
                    {
                        Console.WriteLine(" - The scanCONTROL is a undefined type\nPlease contact Micro-Epsilon for a newer SDK");
                    }

                    // Get all possible resolutions for connected sensor and save them in array
                    Console.WriteLine("Get all possible resolutions");
                    if ((iRetValue = CLLTI.GetResolutions(m_hLLT, auiResolutions, auiResolutions.GetLength(0))) < CLLTI.GENERAL_FUNCTION_OK)
                    {
                        OnError("Error during GetResolutions", iRetValue);
                        bOK = false;
                    }

                    // Set the max. possible resolution
                    m_uiResolution = auiResolutions[0];
                }


                // Set scanner settings to valid parameters for this example

                if (bOK)
                {
                    Console.WriteLine("\n----- Set scanCONTROL Parameters -----\n");

                    Console.WriteLine("Set resolution to " + m_uiResolution);
                    if ((iRetValue = CLLTI.SetResolution(m_hLLT, m_uiResolution)) < CLLTI.GENERAL_FUNCTION_OK)
                    {
                        OnError("Error during SetResolution", iRetValue);
                        bOK = false;
                    }
                }



                if (bOK)
                {
                    Console.WriteLine("Set Profile config to PROFILE");
                    if ((iRetValue = CLLTI.SetProfileConfig(m_hLLT, CLLTI.TProfileConfig.PROFILE)) < CLLTI.GENERAL_FUNCTION_OK)
                    {
                        OnError("Error during SetProfileConfig", iRetValue);
                        bOK = false;
                    }
                }

                while (true)
                {
                }

                if (bOK)
                {
                    Console.WriteLine("Set trigger to internal");
                    if ((iRetValue = CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_TRIGGER, 0x00000000)) < CLLTI.GENERAL_FUNCTION_OK)
                    {
                        OnError("Error during SetFeature(FEATURE_FUNCTION_TRIGGER)", iRetValue);
                        bOK = false;
                    }
                }

                if (bOK)
                {
                    Console.WriteLine("Set shutter time to " + m_uiShutterTime);
                    if ((iRetValue = CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_SHUTTERTIME, m_uiShutterTime)) < CLLTI.GENERAL_FUNCTION_OK)
                    {
                        OnError("Error during SetFeature(FEATURE_FUNCTION_SHUTTERTIME)", iRetValue);
                        bOK = false;
                    }
                }

                if (bOK)
                {
                    Console.WriteLine("Set idle time to " + m_uiIdleTime);
                    if ((iRetValue = CLLTI.SetFeature(m_hLLT, CLLTI.FEATURE_FUNCTION_IDLETIME, m_uiIdleTime)) < CLLTI.GENERAL_FUNCTION_OK)
                    {
                        OnError("Error during SetFeature(FEATURE_FUNCTION_IDLETIME)", iRetValue);
                        bOK = false;
                    }
                }


                // Main tasks in this example
                if (bOK)
                {
                    Console.WriteLine("\n----- Poll from scanCONTROL -----\n");

                    GetProfiles_Poll();
                }

                Console.WriteLine("\n----- Disconnect from scanCONTROL -----\n");

                if (bConnected)
                {
                    // Disconnect from the sensor
                    Console.WriteLine("Disconnect the scanCONTROL");
                    if ((iRetValue = CLLTI.Disconnect(m_hLLT)) < CLLTI.GENERAL_FUNCTION_OK)
                    {
                        OnError("Error during Disconnect", iRetValue);
                    }
                }
            }

            //Wait for a keyboard hit
            while (true)
            {
                cki = Console.ReadKey();
                if (cki.KeyChar != 0)
                {
                    break;
                }
            }
        }