Esempio n. 1
0
        private bool IsListReady(uint count)
        {
            if (this.CtlGetStatus(RtcStatus.Aborted))
            {
                return(false);
            }
            const uint RTC5_LIST_BUFFER_MAX = 4000;

            if ((this.listCount + count) >= RTC5_LIST_BUFFER_MAX)
            {
                uint busy, position;
                busy = position = 0;
                RTC5Wrap.n_get_status(this.Index + 1, out busy, out position);
                if (0 != busy)
                {
                    RTC5Wrap.n_set_end_of_list(this.Index + 1);
                    RTC5Wrap.n_execute_list(this.Index + 1, this.listIndex);
                    this.listIndex = this.listIndex ^ 0x03;
                    RTC5Wrap.n_set_start_list(this.Index + 1, this.listIndex);
                }
                else
                {
                    RTC5Wrap.n_set_end_of_list(this.Index + 1);
                    if (this.CtlGetStatus(RtcStatus.Aborted))
                    {
                        return(false);
                    }

                    RTC5Wrap.n_auto_change(this.Index + 1);
                    uint readStatus = 0;
                    switch (this.listIndex)
                    {
                    case 1:
                        do
                        {
                            readStatus = RTC5Wrap.n_read_status(this.Index + 1);
                            System.Threading.Thread.Sleep(1);
                        }while (Convert.ToBoolean(readStatus & 0x20));
                        break;

                    case 2:
                        do
                        {
                            readStatus = RTC5Wrap.n_read_status(this.Index + 1);
                            System.Threading.Thread.Sleep(1);
                        }while (Convert.ToBoolean(readStatus & 0x10));
                        break;
                    }
                    if (this.CtlGetStatus(RtcStatus.Aborted))
                    {
                        return(false);
                    }
                    this.listIndex = this.listIndex ^ 0x03;
                    RTC5Wrap.n_set_start_list(this.Index + 1, this.listIndex);
                }
                this.listCount = count;
            }
            this.listCount += count;
            return(true);
        }
Esempio n. 2
0
 public bool ListBegin()
 {
     Debug.Assert(this.CtlGetStatus(RtcStatus.NotBusy));
     this.listIndex = 1;
     this.listCount = 0;
     this.aborted   = false;
     RTC5Wrap.n_set_start_list(this.Index + 1, this.listIndex);
     return(true);
 }
Esempio n. 3
0
        public bool CtlFrequency(double frequency, double pulseWidth)
        {
            if (this.CtlGetStatus(RtcStatus.Busy))
            {
                return(false);
            }
            double period     = 1.0f / frequency * (double)1.0e6;
            double halfPeriod = period / 2.0f;

            RTC5Wrap.n_set_start_list(this.Index + 1, 1);
            RTC5Wrap.n_set_laser_timing(this.Index + 1,
                                        (uint)(halfPeriod * 64.0),
                                        (uint)(pulseWidth * 64.0),
                                        0,
                                        0);
            RTC5Wrap.n_set_end_of_list(this.Index + 1);
            RTC5Wrap.n_execute_list(this.Index + 1, 1);
            this.CtlBusyWait();
            return(true);
        }
Esempio n. 4
0
 public bool CtlDelay(double laserOn, double laserOff, double scannerJump, double scannerMark, double scannerPolygon)
 {
     if (this.CtlGetStatus(RtcStatus.Busy))
     {
         return(false);
     }
     RTC5Wrap.n_set_start_list(this.Index + 1, 1);
     RTC5Wrap.n_set_scanner_delays(this.Index + 1,
                                   (uint)(scannerJump / 10.0),
                                   (uint)(scannerMark / 10.0),
                                   (uint)(scannerPolygon / 10.0)
                                   );
     RTC5Wrap.n_set_laser_delays(this.Index + 1,
                                 (int)(laserOn * 2.0),
                                 (uint)(laserOff * 2.0)
                                 );
     RTC5Wrap.n_set_end_of_list(this.Index + 1);
     RTC5Wrap.n_execute_list(this.Index + 1, 1);
     this.CtlBusyWait();
     return(true);
 }