Register    Login    Forum    Search    FAQ

Board index » Programming Alarm Modems » TiXML




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Code example "counter"
 Post Posted: Tue Oct 11, 2005 1:17 pm 
Offline
Tixi-Support-Team

Joined: Mon Oct 10, 2005 1:40 pm
Posts: 94
Location: Berlin
Because there was already a request for a "counter" function, here a working example to count impulses by the Alarm Modem digital input P0 using math operations.

At first an process variable "counter" with start value 0 is defined.
ProcessVars:
[<SetConfig _="PROCCFG" ver="y">
<ProcessVars>
<Counter def="0"/>
</ProcessVars>
</SetConfig>]

There follows an EventState which triggers an Event "Count" with every impulse (flank High) at the input P0.
EventState:
[<SetConfig _="PROCCFG" ver="y">
<EventStates>
<Count>
<Enabled _="TRUE"/>
<ProcessVar _="Process/MB/IO/I/P0" flank="high"/>
<Event _="Count">
</Event>
</Count>
</EventStates>
</SetConfig>]

The Event adds the positive state of the input P0 by means of instruction ADD to the before defined aprocess variable "counter" and writes back the new value in the same.
EventHandler:
[<SetConfig _="EVENTS" ver="y">
<EventHandler>
<Count>
<Process>
<LD _="/Process/MB/IO/I/P0"/>
<LD _="/Process/PV/Counter"/>
<ADD _=""/>
<ST _="/Process/PV/Counter"/>
</Process>
</Count>
</EventHandler>
</SetConfig>]

_________________
Tixi Support Team

E-Mail-Support, Mo-Fr, 9:00am - 5:00pm, Tixi-Support@tixi.com
Support-Hotline, Mo-Fr, 9:00am - 5:00pm, +49-30-406 08 300


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 1 post ] 

Board index » Programming Alarm Modems » TiXML


Who is online

Users browsing this forum: No registered users and 7 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron