Adding To a Date

Kayser

Member
Join Date
Jul 2011
Location
Missouri
Posts
9
Hi,

I am working with a CompactLogix L23E with a Panel View Plus 600, Im doing a calibration process that when complete it copies the current date into a variable, format 99/99/9999, I want to allow the our quality dept to be able to select when the the system needs to be calibrated again by selecting 3 months 6 months or 12 months, Is there any easy way to add 3,6, 12 months to the date so it will select a valid date

thanks
 
Use GSV instruction, see attached fig., calendario is an array with seven positions as follows:year, month, day, hour, minute, seconds and microseconds all are DINT. In calendario you have actual date and time info, you can setup your date and time info to be display as you want on the PV+. You can use info from calendario to be compared with your future date and time, as needed.
 
Kayser said:
I want to allow the our quality dept to be able to select when the the system needs to be calibrated again by selecting 3 months 6 months or 12 months, Is there any easy way to add 3,6, 12 months to the date so it will select a valid date

thanks

It depends on your definition of easy, and what day of the month they utilize this feature.

If it is on or before the 28th day of the month then there should be no problem simply adding the number of months to the Month element, and then if the result is greater than 12, subtract 12.

Now, if it is the 29th, 30th or 31st, perhaps you just keep it simple and force the day of month to 28, which isn't exactly six months but pretty darn close.

This is assuming you already know how to GSV the Wallclock time and store it in an array of tags for your usage.
 
Since your dealing with a ControlLogix, math calculations can be easier. Search the web to find out the equations to convert a date into a serial number. This is usually the number of days since another date, like 1/1/1900 or something. Then you add the number of days you want to the serial number, then use another equation to convert the new serial number back to a MM/DD/YYYY format.
 
You could use the TOT instruction. Set EnableIn=1, In=1.0, and make the time base 3. Then it will totalize days. Set target = the number of days till the next calibration. After that add to target the number of days till the next calibration. TargetDev1 then reports back the number of days left on the current calibration cycle, allowing you to have an early warning alarm. Refer to online help on TOT instruction.
 
Thanks for all the suggestions, I found the post from OkiePc to be the easiest, but I did try to use the others posts aswell

thanks for the help
 

Similar Topics

Hello everyone. I am in need of some assistance. I want to add some logic to a PLC to trigger an alert on the HMI that it is time to clean the...
Replies
20
Views
4,286
Hello: I'm working in the Connected Component Workbench environment with a Micro820 PLC. Is there a way to add-subtract date & time values. Thanks
Replies
7
Views
3,528
Hi Everyone, Currently we have three plants running with Controllogix PLCs (L72, L73, L74). In each of these plants we have 2 FTView SE...
Replies
0
Views
54
Hello, Im building project with 1756-L82ES controller and 1756-IB16S card but i cant find it when trying to add the card to IO configuration...
Replies
3
Views
135
Hello, I have a pair of redundant 1756-L71 controllers rev 24. These controllers currently have produced and consumed tag interfaces to 3 other...
Replies
2
Views
158
Back
Top Bottom