Passing hmi interger values into timers

ISL_MAN

Member
Join Date
Aug 2005
Location
rOTHERHAM
Posts
20
How do I convert a integer which contains a number of miliseconds so I can load it into a timer which seems to want it in the format S5T#100Ms. I dont want to have to change the type to anything else as it comes from a recipe value which comes from HMI.
 
Last edited:
Just remeberd I've done this before a few years ago. I convert my interger into BCD and xor it with 2000 to change the time base


ISL_MAN said:
How do I convert a integer which contains a number of miliseconds so I can load it into a timer which seems to want it in the format S5T#100Ms. I dont want to have to change the type to anything else as it comes from a recipe value which comes from HMI.
 
I prefer IEC timers for a number of reasons. One of them is that it is easier to use the values from a HMI driectly.

The format of the setpoint for an S5 timer is:
· W#16#wxyz
· Where w = the time base (that is, the time interval or resolution)
· Where xyz = the time value in binary coded decimal format
 
Time Base Binary Code for the Time Base
10 ms 00
100 ms 01
1 s 10
10 s 11



The milliseconds timer setpoint should allready be in BCD format. If not, you must convert it from INT to BCD with the ITB instruction.
As the smallest resolution for an S5 timer is 10 ms, so should the value from the HMI also be in 10 ms resolution ("12" = 120 ms).
It could look like this:

if 10 msec timebase is used:
L "HMI_SP" 
ITB //remove this line if HMI_SP is allready BCD
L W#16#0FFF //first 4 bits set to zero = 10 ms timebase.
AW //combine HMI_SP and 0FFF to make BCD setpoint.
T "S5Timer_SP"



10 msec timebase it a little different from the other timebases.
Example if 1 sec timebase is used:
L "HMI_SP" 
ITB //remove this line if HMI_SP is allready BCD
L W#16#0FFF
AW //strip the last 4 bits from HMI_SP
L W#16#2000 //first 4 bits set to 0010 = 1 sec timebase.
0W //combine HMI_SP and 2000 to make BCD setpoint.
T "S5Timer_SP"

 
I convert my interger into BCD and xor it with 2000 to change the time base
The "2000" must be for 1 sec timebase.
Also, with XOR you must check the the value from the HMI doesnt exceed 0-999, otherwise it will make problems.

edit: If the HMI happens to be a Siemens panel or PC runtime, then you can set lower and upper limits to the tags. You can set them to 0 and 999 to avoid unexpected behavior by the code.
Use 2 decimal points to format the setpoint to seconds on the HMI ("123" = 1230 milliseconds = 1.23 seconds).
 
Last edited:

Similar Topics

I'm using FactoryTalk ME version 13. I'm aware how to pass a parameter file once, but I was wondering if it is possible to do it twice...
Replies
4
Views
171
I inherited a project in which a ME application displays process measurements (temp, pressure, flow, etc) on a PanelView Plus display. The data...
Replies
4
Views
513
My first real attempt at utilising the AOI function in Compactlogix. The issue I'm having is, I have an array of INT[400], but in my AOI I'm only...
Replies
1
Views
475
Hi guys. Sorry for the dumb question but I am still new. I have learned to pass Parameters using an HMI tag so far. Can I write directly to the...
Replies
1
Views
939
Hi guys, A dumb question, but is it possible to pass values to tags using parameter files in Ftview SE ver 11? TIA
Replies
2
Views
1,483
Back
Top Bottom