Skip to content

Commit

Permalink
Bug fix, clear prescale counter first when prescaling
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkRivers committed Sep 14, 2024
1 parent 3519204 commit b72adb8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions measCompApp/src/drvUSBCTR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,16 @@ int USBCTR::startMCS()

if ((channelAdvance == mcaChannelAdvance_External) && (prescale > 1) ) {
#ifdef _WIN32
// LOADREG0=0, LOADREG1=1, so we use addr
status = cbCLoad32(boardNum_, prescaleCounter, 0);
status = cbCLoad32(boardNum_, OUTPUTVAL0REG0+prescaleCounter, 0);
status = cbCLoad32(boardNum_, OUTPUTVAL1REG0+prescaleCounter, prescale-1);
status = cbCLoad32(boardNum_, MAXLIMITREG0+prescaleCounter, prescale-1);
mode = OUTPUT_ON | RANGE_LIMIT_ON;
status = cbCConfigScan(boardNum_, prescaleCounter, mode, CTR_DEBOUNCE_NONE, CTR_TRIGGER_BEFORE_STABLE,
CTR_RISING_EDGE, CTR_TICK20PT83ns, 0);
#else
status = ulCClear(daqDeviceHandle_, prescaleCounter);
status = ulCLoad(daqDeviceHandle_, prescaleCounter, CRT_OUTPUT_VAL0, 0);
status = ulCLoad(daqDeviceHandle_, prescaleCounter, CRT_OUTPUT_VAL1, prescale-1);
status = ulCLoad(daqDeviceHandle_, prescaleCounter, CRT_MAX_LIMIT, prescale-1);
Expand Down

0 comments on commit b72adb8

Please sign in to comment.