Convert Byte to DINT

If the byte is allways positive (0-255), do like this;
L DB*.DBB*
T DB*.DBD*

If it's a signed byte (-128 to 127), do it like this:
L DB*.DBB*
SLD 24 // Move the byte to leftmost byte in akku
SSD 24 // Move the byte back with sign
T DB*.DBD*

Kalle
 
Byte 0 Year 90 ... 89 (from 1990 to 2089)
Byte 1 Month 01 to 12
Byte 2 Day 1 to 31
Byte 3 Hour 0 to 23
Byte 4 Minute 0 to 59
Byte 5 Second 0 to 59
Byte 6 2 MSD of ms 00 to 99
Byte 7 (4 MSB) LSD of ms 0 to 9
Byte 7 (4 LSB) Day of week 1 to 7 (1 = Sunday)

What I need to do is move each of these 7 bytes to Double Intergers. When I do it for the year for example I get 16 instead of 2010
 
Last edited:

Similar Topics

Hello experts :) I'm new to Codesys (3.5) and I am trying to make a program which takes a number 1-50 (read from some tags UID) and outputs each...
Replies
15
Views
7,470
Hello all, I'm currently working on a servo motor linear positioning system (ball screw). I'm all set up regarding communication between my HMI...
Replies
1
Views
87
I have an application using an incremental encoder and then I convert it to degree (0-360) using calculation program. For a while, the calculation...
Replies
7
Views
233
Hi all. Me again still learning Rockwell. So I'll be polling an INT data array from a Modbus SE power meter with a L82 (with a Modbus ProSoft in...
Replies
56
Views
1,356
Hello, could someone kindly convert the attached RSP files that are currently used for SLC 5 PLC into PDF please
Replies
6
Views
519
Back
Top Bottom