LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming Ultrasonic sensor HC-SR04

Hi Gerd,

 

I am using the PFI0  for trigger and I am designing a counter. ( I am using a digital input (of usb6008) (echo pin connected to it) and reading the boolean value. For each true, the counter is incremented.

 

I've attached my counter part

0 Kudos
Message 11 of 22
(1,394 Views)

Here is my vi

What's wrong?

 

Please help!

0 Kudos
Message 12 of 22
(1,376 Views)

Hi kdm,

 

I don't know what's wrong. You don't tell us, what's not working as expected…

 

- You read your DI once each 14ms (due to AI task set to 1000S/s and 14 Samples/read).

- You increment your counter on each edge of the digital input - that's different to your text "increment on TRUE".

- You do a lot of stuff more complicated then needed to…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 22
(1,369 Views)

Hi Gerd,

 

What does this error mean..

 

Possible reason(s):

Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property.

Property: SampTimingType
Requested Value: Change Detection
You Can Select: On Demand

 

No, I think I read my samples for every 140us  (due to AI task set to 100000S/s and 14 Samples/read). ..as minimum width of the pulse of echo is 150us.

0 Kudos
Message 14 of 22
(1,365 Views)

Hi kdm,

 

the USB6008 is NOT ABLE to read a AI with 1MS/s. AGAIN: read the specs of the USB6008!

 

You alse mis-wired your settings: You did wire a 1000 to rate input of DAQmxTiming and a 100,000 to sample size input. Please read the context help for that function…

 

That error message is quite clear: you wired a property setting that is not supported by your hardware!

 

Conclusion: READ THE SPECS!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 22
(1,354 Views)

Hi Gerd,

 

Okay

 

I think my trigger is not generating 10us. How to check that?

0 Kudos
Message 16 of 22
(1,350 Views)

For a 10us trigger, what should the high time and low time be?

0 Kudos
Message 17 of 22
(1,333 Views)

Hi kdm,

 

you can check your outputs using a scope…

 

AGAIN: Read the specs of the USB6008. It is not able to prduce 10µs pulses!

Best regards,
GerdW


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

Hi Gerd,

 

The specs says that the minimum input pulse width is 100ns. I could not find any details about the minimum __output__ pulse width.

0 Kudos
Message 19 of 22
(1,317 Views)
You aren't making any sense. There is a spec for the trigger input to the basic event counter. There is no such thing as a trigger output. The only output you have is the digital I/O and that is software timed. The minimum pulse it's going be in milliseconds with considerable jitter. You've been told numerous times that the device is not capable of generating a 10us pulse.
0 Kudos
Message 20 of 22
(1,313 Views)