S7 date and time

guest

Guest
G
Can anyone tell me how to display the actual date and time if you use a DT in a data block. I know it will not show you in the data view if you are online because it is 8 bytes.

Thanks
 
Guest

You will have to split the 8 bytes up into single bytes, then the info is as follows:

1st byte = Year
2nd byte = month
3rd byte = day
4th byte = hour
5th byte = minutes
6th byte = seconds
7th byte = milliseconds
8th byte = milliseconds (4 MSB's) and day of the week (4 LSB's)

The day of the week starts at sunday, so sunday = 1, monday = 2 and so on until saturday = 7.

These bytes are in HEX, so you will have to convert them to INT in the DB, just declare the TYPE as INT.

Paul
 
Just one minor correction: The bytes will be in BCD format, so you will have to use the BTI instruction to convert them to integers.

Another problem with displaying them as an INT in a DB is that you can't view a byte as an INT. It is always in HEX view. So, when I use the Date_Time function, I always use a local variable, convert the bytes inside my function, and then pass the converted variables (day, month, etc) to a struct in my DB.
 
S7Guy said:
Just one minor correction: The bytes will be in BCD format, so you will have to use the BTI instruction to convert them to integers.

Thank you for putting me right on that! šŸ™ƒ

I was writing from memory, the ol' grey matter ain't as good as it used to be! banghead

Paul
 
Hi Paul,
What are you doing up at this hour? I would have thought that you would be at the pub getting ready for my up-coming visit... I got the job w/ the Biodigester Co...on my way down to get my Passport renewed right now!!!!
David beerchug
 
David_Emmerich said:
Hi Paul,
What are you doing up at this hour?

Hour? It is early evening on this side of the pond, I haven't long been in from work.

]Originally posted by David_Emmerich
I would have thought that you would be at the pub getting ready for my up-coming visit...

Weekend drinker only me! I don't believe in drinking during the week especially when I have work the next day!

David, you will have to PM or email me when you are coming over.

Paul

P.S to Guest, my appolgies for this thread turning into a personal conversation between myself and David.
 
Can you please show how to set up a Vat table or DB to display the actual values.

Thank You
 

Similar Topics

Hi All, we've recently upgraded from FTView SE v10 to v12. Since the upgrade we've been having a problem where the HMI is slow to update tags in...
Replies
0
Views
36
Good Morning , Not sure how many use Markem-Imaje SmartDate X60 Printers , but I'm having trouble finding a good manual for...
Replies
3
Views
346
Hi, I have an iFIX 5.5 project (Windows 7) that needs to be updated to version 6.5 (Windows 10). iFIX communicates with the "Siemens Industrial...
Replies
1
Views
145
Hi I have a number of the older PanelView Plus 600 HMI's (2711P-T6C20D, Ser D) that I want to update to the latest firmware. I believe that the...
Replies
10
Views
390
Hello all, I am trying to set PLC clock using DATE function. When DATE function is enabled, I can see A351 to A354 change to the register...
Replies
3
Views
361
Back
Top Bottom