发表于:2006/3/4 11:09:00
#0楼
有没有同行有modbus time format的读写经验,我需要把时间写入modbus从站,占4个寄存器,谢谢分享!以下是从站数据格式说明。
TIME FORMAT 64 bit
All Times and Dates available to be read or written via MODBUS in the Model 2000
are in the TIME or Modbus TIME format which is a 64 bit number with the following
attributes:-
SSMMHHWDDDmmYYxx
Where
SS Seconds valid numbers in the range 0 to 59
MM Minutes valid numbers in the range 0 to 59
HH Hours valid numbers in the range 0 to 23 (0=midnight)
WD Week Day Number valid numbers in the range 1 to 7 (1=Sunday)
DD Day valid numbers in the range 1 to 31
mm Month valid numbers in the range 1 to 12
YY Years valid numbers in the range 0 to 99 (assumed to be 20xx)
xx Fault/Validation code
Notes
1) The above item will be recognised by the M2000 and windows software as a time and
Date format. It cannot be cast as any other format i.e. a double or float etc.
2) It can sent in any available byte order i.e. 1234 or 4321
3) It can be split in to available register sizes i.e. 1*8 or 2*4 etc.
4) For writing the Time and Date the Week Day does not need to be correct only valid
the M2000 will correct it , so e.g. it could always be written as 1.
5) For writing the Time and Date the Fault/Validation code is ignored i.e. it does not need
to have any value.
6) For reading if the Validation code is set the Time and Date is Valid if it is returned as 0 (zero) then the RTC device in the M2000 is faulty.
TIME FORMAT 64 bit
All Times and Dates available to be read or written via MODBUS in the Model 2000
are in the TIME or Modbus TIME format which is a 64 bit number with the following
attributes:-
SSMMHHWDDDmmYYxx
Where
SS Seconds valid numbers in the range 0 to 59
MM Minutes valid numbers in the range 0 to 59
HH Hours valid numbers in the range 0 to 23 (0=midnight)
WD Week Day Number valid numbers in the range 1 to 7 (1=Sunday)
DD Day valid numbers in the range 1 to 31
mm Month valid numbers in the range 1 to 12
YY Years valid numbers in the range 0 to 99 (assumed to be 20xx)
xx Fault/Validation code
Notes
1) The above item will be recognised by the M2000 and windows software as a time and
Date format. It cannot be cast as any other format i.e. a double or float etc.
2) It can sent in any available byte order i.e. 1234 or 4321
3) It can be split in to available register sizes i.e. 1*8 or 2*4 etc.
4) For writing the Time and Date the Week Day does not need to be correct only valid
the M2000 will correct it , so e.g. it could always be written as 1.
5) For writing the Time and Date the Fault/Validation code is ignored i.e. it does not need
to have any value.
6) For reading if the Validation code is set the Time and Date is Valid if it is returned as 0 (zero) then the RTC device in the M2000 is faulty.
[此贴子已经被作者于2006-3-5 19:36:58编辑过]