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

From the Red Lion website, after some customer enquiries in the last week or so... Rev. March 25, 2024 [18:30] Just thought it might help a...
Replies
9
Views
247
How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
92
Has anyone found a way to convert/replace/update the firmware on old Parker TS80xx series HMIs (i.e. TS8010, TS8006, etc) to accept Crimson...
Replies
0
Views
85
Hello, I have an automation direct d2 262 plc and C-more HMI EA9T6CL-R. I need to prepare a program, scheduled to be performed on a future date. I...
Replies
1
Views
112
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
85
Back
Top Bottom