
adccommunitymod (AutomationDirect) asked a question.
Created Date: August 06,2009
Created By: krak
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
I am working on a project that requires a machine to be serviced once a month by only approved service techs. I have been asked to secure the plc and cmore to prevent tampering. I think I have come up with a solution but I am still working out the details. I have two questions. First, if the d0-06 is locked with a password, can a d0-06lcd be used to change the calendar settings? Second, I would like to set up a counter to allow 45 days of use, since the last service. It doesn’t matter if the machine has not been used, the counter would advance once a day. It can only be reset by the service tech via the cmore. It is possible that the machine could be powered down at times, weekends mostly. So I want to compare the internal calendar to a previous memory. If there is a change then add a tick to the counter. I’m hitting a mental block how to deal with the change of a month and year. It would be nice to be able to count the days of the year, but I’m sure how to set that up either since the machine can be powered down. I saw some good thoughts on counting the weeks, and I am hoping someone help me figure this out as well. Thank you
Created Date: August 06,2009
Created by: bcarlton
1. I have no idea if the LCD display can change the date on a password protected CPU.
2. The supplied subroutine will develop a number close to the number of days since 1/1/2000 from the RTC. Use it when maintenance is finished to get a 'Last Maintenance Date '. Then each day call it to get 'today's Date '. Do a SUBD to get 'Number of days since last maintenance '. OK - so it can be off 1 or 2 days. If it's critical we can do a REALLY complex version. Note: my original program post was modified adding a 'sUBD K1 ' command.
PLC 06
// Rung 1
// Address 0
#BEGIN COMMENT
"Example useage of the supplied subroutine in K1 "
#END
GTS K1
POP
OUTD V2000
// Rung 2
// Address 4
END
// Rung 3
// Address 5
SBR K1
// Rung 4
// Address 7
#BEGIN COMMENT
"Develops a number which is close to the number of days since 1/1/2000 (with minimal "
"math. (Off up to 1.5 days a year). The result is on the stack. Use POP to retrieve it then "
"store into a double word location. "
#END
LD V7773
SUBD K1
MUL K305
DIV K10
LD V7774
MUL K365
ADDS
ADD V7772
// Rung 5
// Address 14
RT
// Rung 6
// Address 15
NOP
#BEGIN ELEMENT_DOC
"V2000 ", "Rough Date ", " ", "Holds a double BCD number roughly related to the number of days since 1/1/2000 "
"V2001 ", "RD 1 ", " ", " "
"V7772 ", "Day of Month ", " ", " "
"V7773 ", "Month ", " ", " "
"V7774 ", "Year ", " ", " "
#END
Created Date: August 06,2009
Created by: krak
BCarlton,
Thank you. That is a much simpler approach then what I was working on. I changed your code around a bit using stages and an outd box. It works great. The rest of the comparative logic is almost done as well. The 1.5 day difference is not an issue in case since the Tech should be servicing the once a month, 45 days is allowed for the real world happenings that we all know will get in the way of system from time to time.
Created Date: August 07,2009
Created by: bcarlton
As an example of how crude this simple calculation is - sometimes it will give the same number on the first day of a month after a 31 day month as on the 31st day of that previous month. But, as far as I can tell just by rough mental calculation it shouldn't go backward.
OK - I did a spreadsheet (I'm lazy). The end of February to the first of March is a jump (because of February being so darn short) but otherwise mostly up by 1 each time. A couple of zeroes (as noted above) and a couple of twos (the effect of the 30.5 thing). But, as I guessed, no backwards.
Created Date: August 10,2009
Created by: krak
I’m Glad you tested that. I put in some logic that would detect a roll back in time. I haven’t received the D0-06 lcd yet to test if someone can change the date of a locked plc. So I put some logic in to compare plc’s days to the last recorded days. If the last recorded days is larger than the plc then someone might have rolled the date in plc back. I didn’t think about the counter possibly outputting a smaller number at some point.
Created Date: August 18,2009
Created by: krak
FYI: Even if the D0-06 is locked with a password, the Date and Time can be changed using a D0-06 LCD.
Created Date: August 27,2009
Created by: krak
I should have thought of this before. To lock out the D0-06LCD you can simply use sp1 - lcd box with a k1 "static message ". If it is always on, the LCD can not be used. That is enough on this thread!
Created Date: August 06,2009
Created by: krak
I am working on a project that requires a machine to be serviced once a month by only approved service techs. I have been asked to secure the plc and cmore to prevent tampering. I think I have come up with a solution but I am still working out the details. I have two questions.
First, if the d0-06 is locked with a password, can a d0-06lcd be used to change the calendar settings?
Second, I would like to set up a counter to allow 45 days of use, since the last service. It doesn't matter if the machine has not been used, the counter would advance once a day. It can only be reset by the service tech via the cmore. It is possible that the machine could be powered down at times, weekends mostly. So I want to compare the internal calendar to a previous memory. If there is a change then add a tick to the counter. I'm hitting a mental block how to deal with the change of a month and year. It would be nice to be able to count the days of the year, but I'm sure how to set that up either since the machine can be powered down. I saw some good thoughts on counting the weeks, and I am hoping someone help me figure this out as well.
Thank you