Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RTI, servo tasks and interrupts
Dear all,
How can i know, in a servo task, if the corresponding servo interrupt is the one starting a new rti cycle (rti interrupt) ?

I need to acquire data from a 59E3 card with the minimum jitter (use of servo task) and i need a data every rti (i would like to do the acquisition in the servo task call made between to the rti interrupt and the rti task call)

Also, from servo task, how can i know which motor is currently calling the task? Can i find the Motor index in the Motor structure (Mptr->?) ?

Thank you
To answer your 2nd question, see this thread:
The best solution would be for your routine to monitor the system time (sys.time) value to exceed the current setting for a servo cycle. In the C environment the units of this register are CPU clock cycles. To convert this value to microseconds multiply by Sys.ClockSf (μsec / clock cycle). Note that the RTI will not execute until the servo has finished.
Thank you Steve,
Sorry, I don't understand how looking at the Sys.time can help to detect the "rti interrupt".

I know that the RTI will not execute until the servo has finished and that excatly what i want to use...
I want the acquisition to be done in the first servo call after the "RTI interrupt", and before the "RTI execusion". I have the following frequencies :servo at 4KHz, RTI at 1KHz, so i need to find the right servo call between the 4 calls made.

Do you have a way to detect RTI interrupts? (not the RTI execusion).

If there is no direct way using deltatau/xenomai available status/structures, i guess i will increment a count the beginning of the RTI task, then count servo calls so that i execute my code on the 4th servo call after my RTI execusion increment (this work if we assume the RTI task always starts its execusion between the first and the second servo calls. This should be the case, but, theoretically it depends on MotionProg and other Deltatau tasks executed every RTI interrupt before the RTI task).
There is no built in counter for this but a bright colleague of mine has suggested a simple solution.

In a script RTI PLC:

global myVar
open plc 0
myVar = Sys.ServoCount

Then in your servo task check for every instance where Sys.ServoCount = myVar + 1

Forum Jump:

Users browsing this thread: 1 Guest(s)