Author Topic: knowing the time  (Read 12191 times)

Offline metalninjadragon

  • PLUS+1 Developer
  • ***
  • Posts: 32
  • Karma: +0/-0
knowing the time
« on: March 03, 2011, 09:44:30 PM »
Is it possible to know the standard loop time, or read the current time in ms in a ccp function?

Specificly what I'm trying to:

create in inline block which detects the stabilization of a signal based on configurable criteria.

I've got a ccp function that is keeping tracking a variable at the top level of the program, the id is then passed down
so that blocks can call it's methods to learn about the statistics of a variable (in this case a pressure)

One of the things I'm tracking is stabilization, if the differential of the variable falls below a certain absolute value for a period of time, the signal is considered to have stabilized.

The problem is the period of time, how can the ccp know how long anything has occured? Are there system calls I can make for this? Obviously I could pass an oscillator block into it's input, but I would rather keep it self contained and avoid using pages on top of the block.

thanks



Offline Stefan

  • Administrator
  • PLUS+1 Expert
  • *
  • Posts: 73
  • Karma: +0/-0
Re: knowing the time
« Reply #1 on: March 04, 2011, 01:48:56 PM »
Hello,

Use a component called "Get time in microseconds". You find it in Components tab under Time and Transition.

Place one right before your CCP and another one right after. Subtract the first one from the second one and you get the time the CCP uses. (This can of course be used in any place of you code).

Note: This function is HWD dependent.

Best regards
Stefan

Offline metalninjadragon

  • PLUS+1 Developer
  • ***
  • Posts: 32
  • Karma: +0/-0
Re: knowing the time
« Reply #2 on: March 04, 2011, 03:58:20 PM »
Is there a system call I can make from within the CCP?