Transfer date / timestamp over modbus?

Is there a common format to transfer dates or timestamps over modbus?

I need to transfer dates and times and I can't remember that I've seen a format for it but I'm sure there is one.
In the unix world epoch is common (which is seconds since 1970). But I don't think I encountered it in automation.

Perhaps the date and time can be packed into 2 modbus registers somehow, similar to how floating point numbers works?
 
The only thing Modbus defines is the transmission of raw 16-bit words and bits, it does not define how different data types are sent, much less a date/timestamp.
This.

All times are relative to some epoch.

The "Unix" time, as noted by OP, is a 32-bit integer of seconds past the "Unix epoch" 1970-JAN-01 00:00:00 UTC. As a signed integer (negative values represent times before the epoch) that has a "Y2K" problem sometime in 2038, unsigned it had a problem ca. 2106. If I define my own epoch I can push that back e.g. 27.Oct, 2025 as an epoch is good through 2093 or 2161.

So unsigned 32-bit integers are good for 136y, and can be stored in two 16-but Modbus registers. Byte order within t each register (word) should be handled by the protocol driver, but there is still the issue of word order. I would handle that by allocating there contiguous registers: low word; high word; duplicate low word. That way, LSB-first architectures could retrieve 32-bits correctly ordered by requesting two registers starting at the first low word, and MSB-first architectures could retrieve 32-bits by requesting two registers starting at the high word.

Anyway, that is all a bit of a digression, but the main point is that there is no universal convention. if memory and bandwidth are cheap, there could be six contiguous registers, one each for year, month, day of month, hour of day, minute of hour, second of minute; with seven registers it can get to millisecond resolution or better.
 
The only thing Modbus defines is the transmission of raw 16-bit words and bits, it does not define how different data types are sent, much less a date/timestamp.
I know but that doesn't mean there couldn't be some defacto standard. Like IEEE floating point stored in two consecutive 16 bit registers.
 
I know but that doesn't mean there couldn't be some defacto standard. Like IEEE floating point stored in two consecutive 16 bit registers.
standards.png
 
For many of us - with simple elementary data types like reals - the defacto Modbus standard is what is done in a Modicon PLC. Even that isn't well resolved with things like IEC bit arrays.
The previous answers are good - Modbus carries data in single bits or in 16 bit groups. What you do with those bits is up to you.
The two greatest screwups in PLC clock design are Modicon using BCD in an otherwise binary PLC and Allen Bradley forgetting the technology to calculate the day of the week in their firmware. No excuse for either one.
 
For many of us - with simple elementary data types like reals - the defacto Modbus standard is what is done in a Modicon PLC. Even that isn't well resolved with things like IEC bit arrays.
The previous answers are good - Modbus carries data in single bits or in 16 bit groups. What you do with those bits is up to you.
The two greatest screwups in PLC clock design are Modicon using BCD in an otherwise binary PLC and Allen Bradley forgetting the technology to calculate the day of the week in their firmware. No excuse for either one.
1761655742711.png
 

Similar Topics

Hello all. I'm having an issue where I cant transfer the program from Easysoft V8.25 over onto the PLC. I have updated the PLC to V1.42, and...
1
Replies
515
Views
Hi everyone. I am attempting to transfer several Licenses from an old PC to a new PC via offline transfer. As far as I can understand, I did all...
7
Replies
1,323
Views
New customer recon. Trying to backup all the PLCs and HMs. PLCs are done. So next is tthe Pain. In the Factory Balk Transfer utility, I am not...
20
Replies
1,349
Views
When pushing a new .MER file to an HMI, is there a functional difference between using ME Transfer Utility, vs simply copying the .MER file onto...
7
Replies
1,124
Views
I need old Ebelt software. BTProWin V2.92. I am trying to transfer software to a spare hmi.
0
Replies
420
Views
Top