Skip to content

Commit 4d40f16

Browse files
committed
Changes to allow use of external gate in both scaler and MCS modes.
The change to the software was to invert the polarity of the counter output signals (i.e. C0O-C7O) and the polarity of the counter gate signals (i.e. C0GT-C7GT). The use of an external gate requires an external TTL OR chip. The OR inputs are the external gate signal and the C0O signal. The OR output goes to C0GT-C7GT. The counters are thus disabled by C0O done in scaler mode, and by a TTL low signal on the external gate in scaler and MCS modes.
1 parent 66b61c4 commit 4d40f16

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

measCompApp/src/drvUSBCTR.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -545,11 +545,11 @@ int USBCTR::startMCS()
545545
if (!mcsCounterEnable_[i]) continue;
546546
numMCSCounters_++;
547547
#ifdef _WIN32
548-
mode = OUTPUT_ON | CLEAR_ON_READ;
548+
mode = OUTPUT_ON | CLEAR_ON_READ | GATING_ON | INVERT_GATE | OUTPUT_INITIAL_STATE_HIGH;
549549
status = cbCConfigScan(boardNum_, i, mode, CTR_DEBOUNCE_NONE, CTR_TRIGGER_BEFORE_STABLE,
550550
CTR_RISING_EDGE, CTR_TICK20PT83ns, 0);
551551
#else
552-
mode = CMM_OUTPUT_ON | CMM_CLEAR_ON_READ;
552+
mode = CMM_OUTPUT_ON | CMM_CLEAR_ON_READ | CMM_GATING_ON | CMM_INVERT_GATE | CMM_OUTPUT_INITIAL_STATE_HIGH;
553553
status = ulCConfigScan(daqDeviceHandle_, i, CMT_COUNT, (CounterMeasurementMode) mode,
554554
CED_RISING_EDGE, CTS_TICK_20PT83ns, CDM_NONE, CDT_DEBOUNCE_0ns, CF_DEFAULT);
555555
#endif
@@ -882,8 +882,8 @@ int USBCTR::startScaler()
882882

883883
#ifdef _WIN32
884884
for (i=0; i<numCounters_; i++) {
885-
mode = OUTPUT_ON | COUNT_DOWN_OFF | GATING_ON;
886-
if (i == 0) mode = mode | RANGE_LIMIT_ON | NO_RECYCLE_ON | INVERT_GATE;
885+
mode = OUTPUT_ON | OUTPUT_INITIAL_STATE_HIGH | GATING_ON | INVERT_GATE | COUNT_DOWN_OFF;
886+
if (i == 0) mode = mode | RANGE_LIMIT_ON | NO_RECYCLE_ON;
887887
status = cbCConfigScan(boardNum_, i, mode, CTR_DEBOUNCE_NONE, CTR_TRIGGER_BEFORE_STABLE,
888888
CTR_RISING_EDGE, CTR_TICK20PT83ns, 0);
889889
if (status) {
@@ -903,8 +903,8 @@ int USBCTR::startScaler()
903903
}
904904
#else
905905
for (i=0; i<numCounters_; i++) {
906-
mode = CMM_OUTPUT_ON | CMM_GATING_ON;
907-
if (i == 0) mode = mode | CMM_RANGE_LIMIT_ON | CMM_NO_RECYCLE | CMM_INVERT_GATE;
906+
mode = CMM_OUTPUT_ON | CMM_OUTPUT_INITIAL_STATE_HIGH | CMM_GATING_ON | CMM_INVERT_GATE;
907+
if (i == 0) mode = mode | CMM_RANGE_LIMIT_ON | CMM_NO_RECYCLE;
908908
status = ulCConfigScan(daqDeviceHandle_, i, CMT_COUNT, (CounterMeasurementMode) mode,
909909
CED_RISING_EDGE, CTS_TICK_20PT83ns, CDM_NONE, CDT_DEBOUNCE_0ns, CF_DEFAULT);
910910
if (status) {

0 commit comments

Comments
 (0)