LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is "key down" event with microsecond time resolution possible?

Hi everyone,

I would like to know if by using key down vi is possible to recognize the event of pressing a button with microseconds resolution.

Any help appreciated!

Best- Leo

0 Kudos
Message 1 of 18
(2,592 Views)

Hi Leo,

 


@lelox993 wrote:

I would like to know if by using key down vi is possible to recognize the event of pressing a button with microseconds resolution.

The "key down" event only fires for user input at the keyboard of your computer. Here you get a time with millisecond resolution.

Which "key down VI" are you talking about?

Which "buttons" do you want to recognize?

Best regards,
GerdW


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

@lelox993 wrote:

Hi everyone,

I would like to know if by using key down vi is possible to recognize the event of pressing a button with microseconds resolution.

Any help appreciated!

Best- Leo


I'm a little confused by what exactly you mean.

  1. Will the key down event be fired it the key is down for only a microsecond?  Well, that won't ever happen without a simulated keyboard so I guess that is a maybe.
  2. Can you get the value of the precision timer when the Event is processed, Yes
  3. Can you get the value of the precision timer when the event fires? NO but you can get the ms timer value with millisecond precision +/- OS jitter its avalable from the event data node for all events
  4. Can you modify the Event Inspector Window to display the Hi Res timer instead of the ms timer? NO, its password protected.

"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 18
(2,565 Views)

The VI I'm testing is the followingCattura.JPG

seems that the value of Time is cannot be with time resolution higher than milliseconds

0 Kudos
Message 4 of 18
(2,548 Views)

Hi Leo,

 

from the event structure you only get time in millisecond resolution.

But you can place a HighResolutionTime call inside the event…

Best regards,
GerdW


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

You have observed that right. Lower than ms resolution makes absolutely no sense on any desktop operating system as Windows can't guarantee you even 10ms interval accuracy.

 

The more useful question here is however why do you think you need higher resolution? Academic interest? Practical use case?

If it is more than academical interest your approach is most likely flawed anyways. Keypresses is not something that happens in microseconds.

Rolf Kalbermatter
My Blog
Message 6 of 18
(2,529 Views)

Ok,but is that value really representing the cpu time in which i pressed the button?

 

I've another question: is it possible to go on with the loop even without pressing the button? The event handling structure blocks the iteration... How can I disable this but continuously check for the putton pression?

 

Thank you guys for the answers!!

0 Kudos
Message 7 of 18
(2,525 Views)

You might get microseconds resolution, but not microseconds accuracy. Windows jitter will be anything from 1 us to 100 ms, who knows.

 

Another problem is to actually prove the resolution you're getting.

0 Kudos
Message 8 of 18
(2,524 Views)

I need a trigger for an academic work. In the psychophysical experiment the user must press the spacebar when feels a vibration.

Do you think that the button pression is not the right choose? Do you think that it can work in the milliseconds time order?

0 Kudos
Message 9 of 18
(2,519 Views)

@lelox993 wrote:

Ok,but is that value really representing the cpu time in which i pressed the button?


Of course not!

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 18
(2,518 Views)