Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Time between 2 falling edges


  • Please log in to reply
8 replies to this topic

#1 user1979

user1979
  • Members
  • 62 posts

Posted 11 March 2014 - 07:44 AM

Hello,

 

I am using a Labjack U12 unit and Labview 2011.

 

a) I need to continously measure the time between 2 falling edges (roughly 60 ms for the low state and 15 to 30 secs for the high state).

b) added to a) I need to measure 2 AI quite often over a minute to make a accurate average

 

In order to do this I have used the program attached here. It works ok. It runs roughly at 40ms with some higher peaks (see chart).  (I am measuring 1 sample on 4 channels with loop running as fast as it can). I haven't chosen a #samples+scan rate solution because I would like to avoid missing some edges when the vi launchs a new measure.

 

1) Is there another VI that would enable me to get the samples quicker? (one  sample at a time continously like mine) or is this solution the quickest? of course, it gets quicker when reducing the number of channels in my program but I can't do this.

2) I have been using U6 modules, and I know there are Time Edge measuring VIs. Would there be one that could do this with a U12 unit? I haven't found any .

 

 

Thanks,

 

User



#2 user1979

user1979
  • Members
  • 62 posts

Posted 12 March 2014 - 12:38 AM

Forgot to add the print screen...

Attached Thumbnails

  • Forum.PNG


#3 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 12 March 2014 - 07:13 AM

With the U12, I suggest you use stream mode instead.  You can read 4 analog inputs and the 4 IO at 300 scans/second:

 

http://labjack.com/u12/datarates

 

With any of our newer devices (U3/U6/UE9/T7), you could use a timer or DIO-EF to measure the edge-to-edge time and stream that value along with analog inputs.



#4 user1979

user1979
  • Members
  • 62 posts

Posted 25 March 2014 - 07:38 AM

Hi,

 

Thanks for your answer.

Since my question there has been a change in the a) : the signal can be high for 90 secs (instead of 30 secs in my first post). So what I need to do is :

 

 

a) continously measure the time between 2 falling edges : roughly 60 ms for the low state and 15 to 90 secs for the high state.

 

b) added to a) I need to measure 2 AI quite often over a minute to make an accurate average (no change from my first post)

 

I need to write the data from b) in a file every minute and data from a) to another file every 90 secs.

 

I have tried running stream mode with two U6 modules  in 2 parrallel loops but this doens't work.

 

Could you tell me if it is possible to run in parallel  ? :

 

1 loop with a U6 : 50Hz and 5000 S (I would then make a post treatment to extract the time between 2 falling edges)

1 loop with a U6 : 1kHz and 1000 S

 

Is this is not possible, do you have any suggestions?

 

Thank you very much,

 

User



#5 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 26 March 2014 - 04:14 PM

That should be possible, as each U6 is handled separately in the driver and at the hardware level.

You should be able to set up two separate threads, basically doing what you want to do, without either task interfering with the other.

 

i.e. you could have one program (or thread) open the first U6 and collect it's data, while a second program (or thread) opened the 2nd and collected it's data, each running at different rates and collecting different amounts of data.  It is worth noting for the 50Hz case you shouldn't need to stream and could do a command/response based option, which is generally simpler.

 

What kind of issue are you running into when you try this?



#6 user1979

user1979
  • Members
  • 62 posts

Posted 27 March 2014 - 09:07 AM

I have tested your solution "do a command/response based option" and it works. I can get a new measure every 3 ms which would enable me to make a more accurate measure of my falling edges. However as soon as I use the computer (moose, opening windows, ..) this 3 ms shoots up, far over my target of 20 ms. So I better go with a hard way timing as I wanted wanted to do at first.

 

i have tried doing loop a) with a U3 module and loop b) with a U6 module.

 

I have attached a screenshot of my VI.

 

Loop a) and b) work fine separetly (using the Condition cases). When both conditions are set to True, Loop b) runs fine, and loop a) sends this error message : LabJack Error #8:  Buffer overrun while streaming.  Stream stopped. occured at LJUD_eGetS (DBL Array).vi

 

Do you know what I could change?

 

Thanks,

 

User

Attached Thumbnails

  • Sans titre.PNG


#7 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 31 March 2014 - 09:58 PM

Sounds like you have 3 signals you want to acquire with a U6.  Why don't you just stream all 3 channels at the desired rate on a single U6?  That is going to be the simplest solution.



#8 user1979

user1979
  • Members
  • 62 posts

Posted 02 April 2014 - 02:26 PM

As I said in  my post :

a) continously measure the time between 2 falling edges : roughly 60 ms for the low state and 15 to 90 secs for the high state.

b) added to a) I need to measure 2 AI quite often over a minute to make an accurate average (no change from my first post)

 

I need to write the data from b) in a file every minute and data from a) to another file every 90 secs.

 

Since signal a) can be 90 secs long and because b) is recorded every minute I can't do everyhting with one U6, this is why I am trying to run 2 of them in parrallel.



#9 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 02 April 2014 - 03:50 PM

I don't see why you can't do this with 1 U6.  You simply stream all 3 channels continuously at 1 kscans/second, and then while streaming let software pick out the desired data and write to file whenever you want.

 

So perhaps set it up so your stream read loop happens every 500 ms.  Then you can write whatever data you want at 60s and 90s intervals.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users