
QtSDK と NI-DAQmxBase (Linux) を使った単純なサンプル
| Revision | f15853f1cded7e985ac1237cfe62702285dac622 (tree) |
|---|---|
| Time | 2012-11-01 20:37:02 |
| Author | arakaki <alucky4416@user...> |
| Commiter | arakaki |
CHG: USB-621x Debugged. worked.
| @@ -20,6 +20,7 @@ HEADERS += mainwindow.h \ | ||
| 20 | 20 | |
| 21 | 21 | FORMS += mainwindow.ui |
| 22 | 22 | |
| 23 | +unix:INCLUDEPATH += /usr/local/natinst/nidaqmxbase/include/ | |
| 23 | 24 | |
| 24 | 25 | unix:LIBS += -lnidaqmxbase \ |
| 25 | 26 | /usr/local/lib/LabVIEW-2012/linux/libstdc++.so.5 |
| @@ -79,12 +79,13 @@ void DAQThread::run() | ||
| 79 | 79 | switch (state) { |
| 80 | 80 | case State_IDLE: |
| 81 | 81 | if (event == Ev_Start) { |
| 82 | - qDebug() << QString("start pulse output: freq = %1, ducy = %2").arg(pulse_freq).arg(pulse_duty); | |
| 82 | + qDebug() << QString("start pulse output: freq = %1, duty = %2").arg(pulse_freq).arg(pulse_duty); | |
| 83 | 83 | // int32 DAQmxBaseCreateCOPulseChanFreq (TaskHandle taskHandle, const char counter[ ], const char nameToAssignToChannel[ ], int32 units, int32 idleState, float64 initialDelay, float64 freq, float64 dutyCycle); |
| 84 | 84 | DAQmxErrChk (DAQmxBaseCreateTask("", &taskHandle)); |
| 85 | 85 | DAQmxErrChk (DAQmxBaseCreateCOPulseChanFreq (taskHandle, ctrname, "", DAQmx_Val_Hz, DAQmx_Val_Low, (float64)0.0, pulse_freq, pulse_duty)); |
| 86 | 86 | // int32 DAQmxBaseCfgImplicitTiming (TaskHandle taskHandle, int32 sampleMode, uInt64 sampsPerChanToAcquire); |
| 87 | - DAQmxErrChk (DAQmxBaseCfgImplicitTiming (taskHandle, DAQmx_Val_ContSamps, (uInt64)0)); | |
| 87 | + DAQmxErrChk (DAQmxBaseCfgImplicitTiming (taskHandle, DAQmx_Val_ContSamps, (uInt64)1)); // error, when USB-621x | |
| 88 | + //DAQmxErrChk (DAQmxBaseExportSignal(taskHandle, DAQmx_Val_CounterOutputEvent, "/Dev1/PFI6")); // not worked! , default "/Dev1/PFI4" | |
| 88 | 89 | DAQmxErrChk (DAQmxBaseStartTask (taskHandle)); |
| 89 | 90 | emit pulse_output_started(); |
| 90 | 91 | state = State_OUTPUT; |
| @@ -110,7 +111,7 @@ void DAQThread::run() | ||
| 110 | 111 | // int32 DAQmxBaseCreateCOPulseChanFreq (TaskHandle taskHandle, const char counter[ ], const char nameToAssignToChannel[ ], int32 units, int32 idleState, float64 initialDelay, float64 freq, float64 dutyCycle); |
| 111 | 112 | DAQmxErrChk (DAQmxBaseCreateCOPulseChanFreq (taskHandle, ctrname, "", DAQmx_Val_Hz, DAQmx_Val_Low, (float64)0.0, pulse_freq, pulse_duty)); |
| 112 | 113 | // int32 DAQmxBaseCfgImplicitTiming (TaskHandle taskHandle, int32 sampleMode, uInt64 sampsPerChanToAcquire); |
| 113 | - DAQmxErrChk (DAQmxBaseCfgImplicitTiming (taskHandle, DAQmx_Val_ContSamps, (uInt64)0)); | |
| 114 | + DAQmxErrChk (DAQmxBaseCfgImplicitTiming (taskHandle, DAQmx_Val_ContSamps, (uInt64)1)); | |
| 114 | 115 | DAQmxErrChk (DAQmxBaseStartTask (taskHandle)); |
| 115 | 116 | } |
| 116 | 117 | break; |