예제 #1
0
파일: M320xA.cs 프로젝트: heyjeany/JooYoung
        public void AWGQueueConfig(ControlModule ctrlParameter)
        {
            try
            {
                //Set AWG mode
                double amplitude = 1;
                nAWG = 1; //  100; //averaging
                double hwVer = moduleAOU.getHardwareVersion();
                if (hwVer < 4)
                {
                    nAWG = 0;
                }
                else
                {
                    nAWG = 1;
                }
                moduleAOU.channelWaveShape(0 + nAWG, SD_Waveshapes.AOU_AWG);
                moduleAOU.channelAmplitude(0 + nAWG, 1);
                moduleAOU.channelOffset(0 + nAWG, 0.5);
                moduleAOU.channelWaveShape(1 + nAWG, SD_Waveshapes.AOU_PARTNER);
                moduleAOU.channelAmplitude(1 + nAWG, -1);
                moduleAOU.channelOffset(1 + nAWG, -0.5);
                //Queue settings
                int syncMode = SD_SyncModes.SYNC_CLK10;
                //int queueMode = Convert.ToInt32(SD_QueueMode.CYCLIC);
                //int startDelay = ctrlParameter.AWGTriggerDelay;// Convert.ToInt32(txtAWGDelay.Text); //1 GHz: 19456 + 587;//950 MHz: 19456 + 587 - 1041; //Unit is [10 ns]. Compensate for ~195us delay between AWGout and VXT2out
                //int prescaler = 0, nCycles = 0;// 1; // 0;
                moduleAOU.AWGqueueConfig(nAWG, (int)ctrlParameter.queueMode);
                //moduleAOU.AWGqueueConfig(nAWG, SD_QueueMode.ONE_SHOT); -> this demonstrates the "enum bug"
                moduleAOU.AWGqueueSyncMode(nAWG, syncMode);

                // Addd below setting.
                //Trigger settings
                //int syncMode = SD_SyncModes.SYNC_CLK10;
                int queueMode       = Convert.ToInt32(ctrlParameter.queueMode);
                int extSource       = SD_TriggerExternalSources.TRIGGER_PXI0 + ctrlParameter.AWGExternalPXITriggerNum;
                int triggerBehavior = SD_TriggerBehaviors.TRIGGER_RISE;
                moduleAOU.AWGtriggerExternalConfig(nAWG, extSource, triggerBehavior, syncMode);
                var t = moduleAOU.AWGtriggerExternalConfig(nAWG, extSource, triggerBehavior, syncMode);
                moduleAOU.triggerIOconfig(SD_TriggerDirections.AOU_TRG_OUT);
                int PXIMask = 1 << ctrlParameter.SyncTriggerOut;
                t = moduleAOU.AWGqueueMarkerConfig(nAWG, 3, PXIMask, 1, 0, 1, 18, 0);
                //Log("1.3 Configure Playing AWG.. " + t.ToString());
                //t = moduleAOU.AWGqueueWaveform(nAWG, 0, (int)ctrlParameter.TriggerMode, ctrlParameter.AWGTriggerDelay, ctrlParameter.repeatCycle, 0);
                Log("Config AWG trigger mode and sync mode. ");
            }
            catch (Exception ex)
            {
                Log(ex.Message);
                throw ex;
            }
        }