Sign in to follow this  
Followers 0
PlasticsDude

BCD time and date

8 posts in this topic

Anobody have a link to a good explanation of how to set an RTC (real time clock) using BCD time and date? For example, 16#02 is the year 2002, why?

Share this post


Link to post
Share on other sites
That would depend on the PLC. What are you using? It looks like the 16 is an addative for a fixed figure. In other words, there is a base that the 16 is added to.

Share this post


Link to post
Share on other sites
Have never used one but I believe my previous remarks are probably the basis for the addition. Your local Siemens rep should be able to tell you straight away.

Share this post


Link to post
Share on other sites
seams they only use last two digits so 2002 becomes 02 (could be 1902 if PLCs existed at that time and it can be 2102, 2202 etc but this in another hundred or two hundred years). prefix 16# should indicate format (16-bit value)

Share this post


Link to post
Share on other sites
You could always convert from decimal to bcd using the I_BCD and BCD_I function. Then do the clock in real units.

Share this post


Link to post
Share on other sites
In S7-200, the 16# in front is telling the PLC the data is in the HEX format. BCD format is same as Hex except doesn't go above 9. Without that, PLC assume it's decimal, which would result in different bits being turned on in the word.

Share this post


Link to post
Share on other sites
If you try this library function then you can access the clock in real decimal format.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0