Sequences - Timer Reset


Recommended Posts

I want to set up a button on control page to reset a timer.

I'm using a U3 to monitor a quadrature encoder. Currently the two channels are configured as Encoder_A and Encoder_B. It'w working fine but every attempt to write a sequence to reset it have received "Unknown Error".

I tried using some of the pseudocodes and keep getting erros....URGH!!!

Please Help!

Link to comment
Share on other sites

I've tried a boatload of things but I think the following is getting close to the correct method:

I adapted this code from one of the samples to set the timer value to 0:

Device.Labjack.AddRequest (1, "LJ_ioPUT_TIMER_VALUE", 0, 0, 0, 0)

this caused an error in the line - so, I tried adding


The U3 device is set up as device 1.

Still getting an error.

So, I directly borrowed the config_reset command from the Counter sample program and it still caused an error. I'm writing this note on a different computer and don't have access actual command - but it's one of the sequences in the counter sample.

I know I'm probably missing one silly detail, but just don't see it.

Perhaps the better question is, how do I adapt the pseudocodes in a sequence statement?

Link to comment
Share on other sites

I'm guessing you don't know the answer.

Thanks for the help anyhow - I'll figure someting out on my own.

Have to admit, I'm a little disappointed at the lack of support.

AzeoTech is known for providing great support, and as an extension of that they are very good about monitoring the LabJack forum and quickly answering DAQFactory questions. Perhaps they set the bar too high when they responded to your initial post in 8 minutes, but their second reply was still within 1 business day. I suggest you upload a CTL that demonstrates the problem, and AzeoTech should be able to resolve it quickly. Note that you will have to zip the CTL before attaching to this forum.

Link to comment
Share on other sites

I've uploaded the ctl in zipped format.

The project involves the calculation of rotational inertia by applying a constant torque and measurting acceleration. Well, acceleration is calculated using the quadrature encoder and time. All I'm doing is reading the quadrature encoder and logging to a file with time. For convenience, I want to have a button to zero the encoder. I just haven't had any luck.

Any help is greatly appreciated.

Link to comment
Share on other sites

OK, well, first you have to put all labjack constants (i.e. non-numbers) in quotes. This is probably the main difference between the way functions look in C / VB (in the U3 manual) and in DAQFactory. This is because DAQFactory can't include the C header file so doesn't know what LJ_ioPUT_TIMER_VALUE is, though you could create a constant in script...

Once I changed that, and put quotes around LJ_ioPUT_TIMER_VALUE, it worked just fine. So, perhaps:

1) You don't have the latest version of DAQFactory or the LabJack driver. Although this hasn't changed much in a while, you probably should make sure you are running 5.38. Go to for the latest.

2) You don't have the most recent Labjack driver from Labjack. Go to for this.

3) You don't have the latest firmware for your U3. Again, go to for this.

4) You are using the wrong pins. You have both counters enabled, and truthfully, I always forget whether the counters come before or after the timers, and I believe they come after.

Anyhow, AzeoTech is a software company and we don't have any encoders to test with, but I was able to get counts by simply alternating a wire between gnd and Vs on pins FIO0 and FIO1. Then I was able to click your button that runs the ZeroTimer sequence and the timer got reset to 0. That is, of course, after I put the constant in quotes like you have commented out.

Link to comment
Share on other sites

I also downloaded your CTL and tried it. I am running:

DFE 5.38

U3 Hardware 1.21 (also tested 1.20)

U3 Firmware 1.26

UD 2.64

In your sequence, I uncommented the line with quotes, and commented out the other line. In addition, to get any data from channel Encoder_A I had to change the Timing from 0 to 0.2. After doing that, the program seems to work fine. I connected a wire to GND and tapped it back and forth on FIO0 and FIO1 (after clamping down the screw-terminals). This gave me some random quadrature counts, and then when I pressed your button the count was zeroed.

Note that I can't see any reason for Encoder_B. Since you have Timer0/Timer1 configured as quadrature, they will both read the same value.

Note also that you have enabled both counters, although you do not seem to be using them. Should not hurt anything.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.