RTController is an application which is targeted at HW control of inputs, outputs and encoder signals.
RTController runs as a separate application with high resolution processing of inputs and outputs.
RTController is capable to monitor defined inputs and produce outputs with high accuracy and timing.
RTController is also capable to monitor encoder signals and produce outputs at a defined encoder position.
It also allows user to monitor the input and output states at real-time for easier signal debugging.
Note: to get license contact Tordivel AS (www.scorpionvision.com).
RTController cmdline parameters
RTController.gui.exe "resuscitator.ini path"
The parameter specifies path to the Resuscitator.ini file. If not specified
Resuscitator.ini will be created in the current folder.
Steps to start using RTController
Install Advantech bionic driver.
Copy client files into RTC folder under Scorpion profile.
Copy GUI files into separate folder. Start executable.
Add the following source into Central Start:
import os
import time
try: import CLR
except: import clr as CLR
from CLR.System.Reflection import Assembly
Assembly.LoadFrom(os.path.join(GetStringValue("System.Profile"), "RTC", "RTController.client.dll"))
from CLR.RTController.client import RTControllerClient
from CLR.RTController.RemoteIterfaces import IRTControllerAPI
global rtc
try:
rtc = IRTControllerAPI(RTControllerClient().RTControllerAPI)
except Exception, msg:
print "CreateRtControllerClient exception", msg
Add the following source into Central Stop:
global rtc
rtc.Reset()
Use interface functions to manage tasks in RTController, for example:
global rtc
rtc.SetCurrentDevice(0)
rtc.SetTimerMode()
rtc.SetRepeatableTaskMode(True)
rtc.SetOutputTask(1, 500, 0, 0x0F)
Interface functions
RT Controller can be controlled from Scorpion.
- SetCurrentDevice(id)
- Must be called before any other calls
- Can be called as many times as necessary if device needs to be changed
- id is 0 or 1, it is identical to the device number in Advantech Navigator
- SetCounterMode(counterId)
- Opens the counter. Instructs the subsequent tasks to use counter.
- If counter is used, it must be called prior to any tasks
- counter id as found in Advantech Navigator
- SetTimerMode mode can be interchangably called with SetCounterMode any time
- once open, the counter keeps running even if switching to the Timer mode
- SetTimerMode()
- instructs subsequent tasks to use timer
- SetTimerMode mode can be interchangably called with SetCounterMode any time
- SetRepeatableTaskMode(True/False)
- tells subsequent tasks to be cretaed in repetable or single shot mode
- mode is valid until changed
- SetInputTask(idRising, idFalling, port, byteVal, mask)
- creates Input task. Checks for input DI change.
- idRising,idFalling: unique ids among input and output tasks, will be signalled when input event starts and ends
- port, byteVal, mask: monitor specified port for given condition (value& mask) == (byteVal & mask)
- prior to calling this function make sure SetCurrentDevice, SetCounterMode/TimerMode, SetRepeatableTaskMode are called
- SetOutputTask(id, delay, port, byteVal) or SetOutputTask(id, delay, port, byteVal, refId)
- creates DO Output task. Will write defined byte value to output port.
- id: unique id among input and output tasks
- delay: amount in ms or ticks until task is actually put to execution; if delay is 0 the task is executed immediately
- port, byteVal: output this value
- refId: when specified, this task starts counting only after input or output defined by refId has occured
- prior to calling this function make sure SetCurrentDevice, SetCounterMode/TimerMode, SetRepeatableTaskMode are called
- SetOutputBit(id, delay, port, bitNo) or SetOutputBit(id, delay, port, bitNo, refId)
- functionality identical as above
- set bit value to 1
- ResetOutputBit(id, delay, port, bitNo) or ResetOutputBit(id, delay, port, bitNo, refId)
- functionality identical as above
- set bit value to 0
- ReadInputByte(port) or ReadInputBit(port, bitNo)
- read current value of input port. Will access Advantech device
- ReadOutputByte(port) or ReadOutputBit(port, bitNo)
- read current value of output. Will return the value that was last written to the device
- WriteOutputBit(port, bitNo)
- will write specified bit to the output
- this is a shortcut to SetOutputBit with id==0 and delay==0
- CancelEvent(id)
- delete earlier created event (does not affect counters)
- GetEventTick(refId)
- return counter or timer value at the time the event occured
- if no task exists or if task is not yet activated return 0
- refId: event id of active task
- Reset()
- reinitialize all tasks
- everything must be started from scratch
|