Converting integer to S5 time

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
Here you can see a conversion from integer to an s5 time

But, I don't aunderstand the logic .???

sss2.JPG
 
The S5 time word is split into 4 nibbles.

nibble 0 = time base

nibble 1 to 3 = time preset value in BCD, 000 to 999

what scaling your code is doing I don't know, but basically the third network converts the variable to BCD and blanks off nibble 0, leaving you a number between 0 and 999 BCD.

Network 4, then OR's it with zero, waste of time really as it already was 0, this means nibble 0 = 0 = time base of 1/100th second. The result is the S5 time preset.

If the time base was supposed to be seconds for example, then instead of W#16#0, it would have been W#16#2000.
 

Similar Topics

Hi all, I've got a bit of a need to convert an integer (and a real in another situation) to a string with a particular format. This seems possible...
Replies
11
Views
2,465
How do I convert a float to an integer? I've got a floating-point number D606, value 3999.863. I need to convert it to an integer (4000), then I...
Replies
14
Views
4,229
Hi, Our PLC measures WATER FLOW RATE as an analog input. The PLC reads it as an integer value (D34) in the range 0-4000 as follows: Range...
Replies
12
Views
2,589
Hello folks, Using AB RSLogix micro.. I have a 6 digit ASCII text string and Im looking to convert the 4 most significant digits to an integer...
Replies
2
Views
1,451
Hello everyone! I am trying to figure out how a word - 16 bit can be translated into a double integer (%MD) in Pl7 . Currently the application...
Replies
3
Views
2,670
Back
Top Bottom