gregmmurray
Member
Hello, again ... I'm working with a Micrologix 1200 with RTC module and a PanelView Component C400.
I've created the interface and logic to handle entering dates and times in the HMI and using CPW to update the RTC; everything is (was) working until I was testing yesterday - January 29th. I happened to attempt to change the date to February and the processor faulted with a major fault on the write to the RTC. This is almost certainly due to the fact that, by just changing the "month" field in RTC:0.MON to "2," I created a reference to a date that cannot exist - February 29th, 2013.
The only way I can figure to tackle this is to create three conditional JSRs that, when they detect that it's (1) Feb, (2) April, June, Sept or Nov or (3) Jan, Mar, May, July, Aug, Oct or Dec - and, then, before CPW to RTC:0.MON, adjust the current value of RTC:0.DAY to something safe (but, potentially, not correct).
I suppose, too, that I'll have to do the same, exact, thing for when they change the day, since the HMI doesn't seem to allow me to do conditional input validation.
Am I barking up the right tree? Is there a better/easier way to do this ... seems like a common problem and I'm surprised that there's not a built-in way to do this - or, is there and I've just missed it?
I've created the interface and logic to handle entering dates and times in the HMI and using CPW to update the RTC; everything is (was) working until I was testing yesterday - January 29th. I happened to attempt to change the date to February and the processor faulted with a major fault on the write to the RTC. This is almost certainly due to the fact that, by just changing the "month" field in RTC:0.MON to "2," I created a reference to a date that cannot exist - February 29th, 2013.
The only way I can figure to tackle this is to create three conditional JSRs that, when they detect that it's (1) Feb, (2) April, June, Sept or Nov or (3) Jan, Mar, May, July, Aug, Oct or Dec - and, then, before CPW to RTC:0.MON, adjust the current value of RTC:0.DAY to something safe (but, potentially, not correct).
I suppose, too, that I'll have to do the same, exact, thing for when they change the day, since the HMI doesn't seem to allow me to do conditional input validation.
Am I barking up the right tree? Is there a better/easier way to do this ... seems like a common problem and I'm surprised that there's not a built-in way to do this - or, is there and I've just missed it?
Last edited: