PLUS+1 Tools > PLUS+1 and C

knowing the time


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.



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

Is there a system call I can make from within the CCP?


[0] Message Index

Go to full version