# LabJack counter problem

**URL:** https://mworks.discourse.group/t/labjack-counter-problem/596
**Category:** Support
**Created:** [March 12, 2014, 7:02pm UTC](https://mworks.discourse.group/t/labjack-counter-problem/596 "2014-03-12T19:02:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)
#### Post date: [March 12, 2014, 7:02pm UTC](https://mworks.discourse.group/t/labjack-counter-problem/596/1 "2014-03-12T19:02:06Z")

</div>

Hi Chris,

I’m coming across a problem with the counter plugin. As it is currently written, the counter resets to 0 at the beginning of each trial. However, I think the transition between trials takes long enough that pulses can arrive between the end of one trial and the onset of the next, and so are effectively lost. This is preventing us from keeping our two programs effectively synced. Is it possible to update the counters so that they only resets at the end of an experiment rather than at the end of a trial? Or do you have a different solution to ensure that we are collecting (and accounting for) all pulses?

Thanks!  
Lindsey.

---

<div class="post-metadata">

### Author: ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)
#### Post date: [March 12, 2014, 7:24pm UTC](https://mworks.discourse.group/t/labjack-counter-problem/596/2 "2014-03-12T19:24:22Z")

</div>

Hi Lindsey,

> As it is currently written, the counter resets to 0 at the beginning of each trial.

After looking at the plugin code, I think the only reason that would happen is if you stop and restart the device between trials (probably by calling “start\_device\_io” at the beginning of the trial and “stop\_device\_io” at the end). Is that the case in your experiment? If so, then if you move those actions so that the device is started and stopped just once per protocol, the counter value should be maintained.

Cheers,  
Chris

---

<div class="post-metadata">

### Author: ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)
#### Post date: [March 13, 2014, 8:59pm UTC](https://mworks.discourse.group/t/labjack-counter-problem/596/3 "2014-03-13T20:59:37Z")

</div>

This was exactly the issue- thanks!  
Lindsey.

---

<div class="post-metadata">

### Author: ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)
#### Post date: [July 19, 2022, 11:20pm UTC](https://mworks.discourse.group/t/labjack-counter-problem/596/4 "2022-07-19T23:20:24Z")

</div>


