Exemplo n.º 1
0
        /// <summary>
        /// 初始化振镜
        /// </summary>
        public static void Reset()
        {
            //初始化Dll
            Rtc_Return = RTC5Wrap.init_rtc5_dll();
            if (Rtc_Return != 0u && Rtc_Return != 2u)
            {
                Log.Commandhandler("振镜初始化出错", Rtc_Return);
            }
            //设置兼容RTC4
            //RTC5Wrap.set_rtc4_mode();
            RTC5Wrap.set_rtc5_mode();
            //停止正在执行的Rtc
            //  If the DefaultCard has been used previously by another application
            //  a list might still be running. This would prevent load_program_file
            //  and load_correction_file from being executed.
            RTC5Wrap.stop_execution();

            //加载Correct文件
            Rtc_Return = RTC5Wrap.load_correction_file(
                "./config/Cor_1to1.ct5",
                1u,
                2u
                );
            if (Rtc_Return != 0u)
            {
                Log.Commandhandler("加载D2_1to1.ct5出错", Rtc_Return);
            }
            //加载Program_File文件
            Rtc_Return = RTC5Wrap.load_program_file(null);
            if (Rtc_Return != 0u)
            {
                Log.Commandhandler("加载Program_File出错", Rtc_Return);
            }

            //assigns the previously loaded correction tables #1 or #2 to the scan head control ports
            //and activates image field correction.
            //  table #1 at primary connector (default)
            RTC5Wrap.select_cor_table(1, 1);

            //stop_execution might have created an RTC5_TIMEOUT error
            //复位Rtc
            RTC5Wrap.reset_error(Para_List.Parameter.Reset_Completely);
            //defines the length of the FirstPulseKiller signal for a YAG laser
            RTC5Wrap.set_firstpulse_killer(Convert.ToUInt32(Para_List.Parameter.First_Pulse_Killer * Para_List.Parameter.Rtc_Period_Reference));

            //配置list大小
            //Configure list memory, default: config_list(4000,4000)
            RTC5Wrap.config_list(Para_List.Parameter.List1_Size, Para_List.Parameter.List2_Size);
            //配置激光模式
            RTC5Wrap.set_laser_mode(Para_List.Parameter.Laser_Mode);
            //配置激光控制
            //  This function must be called at least once to activate laser
            //  signals. Later on enable/disable_laser would be sufficient.
            //Bit #0 (LSB) Pulse Switch Setting (doesn’t apply neither to laser mode 4 nor to laser mode 6):
            //    The setting only affects those laser control signals(more precisely: those LASER1 or LASER2
            //    “laser active” modulation pulses in CO2 mode or LASER1 Q - Switch pulses in the YAG modes) that are
            //    not yet fully processed at completion of the LASERON signal(see figure 46 and figure 47).
            //    = 0: The signals are cut off at the end of the LASERON signal.
            //    = 1: The final pulse will fully execute despite completion of the LASERON signal.
            //Bit #1 Phase shift of the laser control signals (doesn’t apply neither to laser mode 4 nor to laser mode 6)
            //    = 0: no phase shift
            //    = 1: CO2 mode: The LASER1 signal is exchanged with the LASER2 signal.
            //    YAG modes: The LASER1 is shifted back 180° (half a signal period).
            //Bit #2 Enabling or disabling of laser control signals for “Laser active” operation
            //    = 0: The “Laser active” laser control signals will be enabled.
            //    = 1: The “Laser active” laser control signals will be disabled.
            //Bit #3 LASERON signal level
            //    = 0: The signal at the LASERON port will be set to active - high.
            //    = 1: The signal at the LASERON port will be set to active - low.
            //Bit #4 LASER1/LASER2 signal level
            //    = 0: The signals at the LASER1 and LASER2 output ports will be set to active-high.
            //    = 1: The signals at the LASER1 and LASER2 output ports will be set to active-low.
            RTC5Wrap.set_laser_control(Para_List.Parameter.Laser_Control);//0x18
            RTC5Wrap.set_firstpulse_killer(Convert.ToUInt32(Para_List.Parameter.First_Pulse_Killer * Para_List.Parameter.Rtc_Period_Reference));

            //activates the home jump mode (for the X and Y axes) and defines the home position
            RTC5Wrap.home_position(Convert.ToInt32(Para_List.Parameter.Rtc_Home.Y * Para_List.Parameter.Rtc_Pos_Reference), Convert.ToInt32(Para_List.Parameter.Rtc_Home.X * Para_List.Parameter.Rtc_Pos_Reference));

            // Turn on the optical pump source and wait for 2 seconds.
            // (The following assumes that signal ANALOG OUT1 of the
            // laser connector controls the pump source.)
            RTC5Wrap.write_da_x(Para_List.Parameter.Analog_Out_Ch, Para_List.Parameter.Analog_Out_Value);

            //定义待机 激光周期和脉冲长度
            //defines the output period and the pulse length of the standby pulses for “laser standby”
            //operation or – in laser mode 4 and laser mode 6 – the continuously-running laser signals
            //for “laser active” and “laser standby” operation.
            RTC5Wrap.set_standby(Convert.ToUInt32(Para_List.Parameter.Standby_Half_Period * Para_List.Parameter.Rtc_Period_Reference), Convert.ToUInt32(Para_List.Parameter.Standby_Pulse_Width * Para_List.Parameter.Rtc_Period_Reference));

            // Timing, delay and speed preset.
            // Transmit the following list commands to the list buffer.
            RTC5Wrap.set_start_list(1U);
            // Wait for Para_List.Parameter.Warmup_Time seconds
            RTC5Wrap.long_delay(Convert.ToUInt32(Para_List.Parameter.Warmup_Time / Para_List.Parameter.Scanner_Delay_Reference));
            RTC5Wrap.set_laser_pulses(
                Convert.ToUInt32(Para_List.Parameter.Laser_Half_Period * Para_List.Parameter.Rtc_Period_Reference),  // half of the laser signal period.
                Convert.ToUInt32(Para_List.Parameter.Laser_Pulse_Width * Para_List.Parameter.Rtc_Period_Reference)); // pulse widths of signal LASER1.
            RTC5Wrap.set_scanner_delays(
                Convert.ToUInt32(Para_List.Parameter.Jump_Delay / Para_List.Parameter.Scanner_Delay_Reference),      // jump delay, in 10 microseconds.
                Convert.ToUInt32(Para_List.Parameter.Mark_Delay / Para_List.Parameter.Scanner_Delay_Reference),      // mark delay, in 10 microseconds.
                Convert.ToUInt32(Para_List.Parameter.Polygon_Delay / Para_List.Parameter.Scanner_Delay_Reference));  // polygon delay, in 10 microseconds.
            RTC5Wrap.set_laser_delays(
                Convert.ToInt32(Para_List.Parameter.Laser_On_Delay * Para_List.Parameter.Laser_Delay_Reference),     // laser on delay, in microseconds.
                Convert.ToUInt32(Para_List.Parameter.Laser_Off_Delay * Para_List.Parameter.Laser_Delay_Reference));  // laser off delay, in microseconds.
            // jump speed in bits per milliseconds.
            RTC5Wrap.set_jump_speed(Para_List.Parameter.Jump_Speed);
            // marking speed in bits per milliseconds.
            RTC5Wrap.set_mark_speed(Para_List.Parameter.Mark_Speed);
            RTC5Wrap.set_end_of_list();
            RTC5Wrap.execute_list(1U);

            //Pump source warming up ,wait!!!
            uint Busy;

            do
            {
                RTC5Wrap.get_status(out Busy, out uint Position);
            } while (Busy != 0U);
        }