LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Impossible to read the encoder with a clock

Hello,

 

I would like to be able to read an angular position provided by an encoder. I've tested the example provided, which reads without a clock, and it works without a problem. However, when I try with the example which requires to choose a clock, whatever my selection, the program loops to infinity (there is -1 on the timout) and no reading is made.

 

Here the inputs :

BaptisteGuilleux_0-1745400847957.png

And the VI:

BaptisteGuilleux_1-1745400896046.png

 

 

0 Kudos
Message 1 of 6
(337 Views)

Hi Baptiste,

 


@Baptiste.Guilleux wrote:
However, when I try with the example which requires to choose a clock, whatever my selection, the program loops to infinity (there is -1 on the timout) and no reading is made.

Did you choose an actual clock signal?

(When there is no clock signal then there will be no samples…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(333 Views)

Hi GerdW,

 

Thank you for your answer. 

I don't think I understand what a clock is exactly.

I have selected this clock for testing cDAQ1/Segment1/ai/SampleClock.

Can NI MAX tell me which clock to use?

 

Best regards,

Baptiste

0 Kudos
Message 3 of 6
(299 Views)

You configure the ai sample clock as the sample clock source, but did you run any AI task to generate the clock

If you didn't, refer to Performing Correlated Digital IO with an M Series Device in LabVIEW to start a dummy AI task.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
0 Kudos
Message 4 of 6
(298 Views)

Hi ZYOng,

 

Thank you for your answer.

I have selected this clock just for testing. I am using the ctr2 counter and I wanted to use the associated sample clock :

BaptisteGuilleux_0-1745407781558.png

but I got the following error :

BaptisteGuilleux_1-1745407817323.png

How do I know which clock should I use ?

0 Kudos
Message 5 of 6
(290 Views)

I have found this solution :

BaptisteGuilleux_0-1745410471150.png

It seems to work, what do you think ?

 

I have another question, I have 2 coder connected on my ni-9402 (ctr2 and ctr3). Is it possible to read the angular position of both coder simultanously ?

0 Kudos
Message 6 of 6
(259 Views)