Jump to content

Recommended Posts

Posted
Hi Gang I am trying to extract the Date and Month from the DT format on a S7-417H CPU - We are using am atomic clock on site for all PLC time/dates and need to translate this to New Zealand time, taking into account Daylight saving. I have looked at FB60 and 61 and they don't help me, having the date/month will allow me to add an hour on the Sunday nearest the 26th March and remove the hour after the 26th October. Any help would be most appreciated Thanks in advance Kev
Posted (edited)
Hi Kev. Not sure what your problem is, but you can extract the details in the Date and Time format from the individual bytes: Byte 0 Year Byte 1 Month Byte 2 Day Byte 3 Hour Byte 4 Minute Byte 5 Second Byte 6+Byte7_1st_nibble Ms Byte 7_2nd_nibble Weekday edit: Important is that all the values are BCD coded. You canvert from BCD to INt with the BTI instruction, and from INT to BCD with the ITB instruction. Edited by JesperMP
Posted
Thanks Jesper / Kevin I had the byte addressing but was unable to get the correct data out using the DIB function - I used your code Kevin - but found a problem with the SFC 1 call - there were too many spaces between SFC and 1, but it is working now. Thanks again Kev
Posted (edited)
It's the best and simple road to extract your data. For example, you can create a Data Block first, and save the date. Then read exclusively the right bytes. Be careful! Remember to convert BCD! Ciao Edited by varlux

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...