Host Engineering Forum

General Category => DirectSOFT => Topic started by: aw on August 20, 2010, 03:31:25 PM

Title: Day of week
Post by: aw on August 20, 2010, 03:31:25 PM
Does anyone know why this function is not working? My V7771 always displays "0" which is Sunday.
I am using Diretsoft5
Title: Re: Day of week
Post by: b_carlton on August 20, 2010, 03:53:53 PM
Which PLC?
Title: Re: Day of week
Post by: aw on August 20, 2010, 04:09:04 PM
DL260
Title: Re: Day of week
Post by: b_carlton on August 20, 2010, 05:19:56 PM
Are any of the other Time/Day fields changing? Do you have any logic in the PLC program which modifies the Time/Date fields?
Title: Re: Day of week
Post by: franji1 on August 23, 2010, 08:41:42 AM
yes, the Time/Date works correctly. I can change it through the program (input from HMI)
Are you also setting the DayOfWeek via the HMI?  The DATE instruction always sets the Year, Month, Day and Day of Week values.
Title: Re: Day of week
Post by: aw on August 23, 2010, 08:47:45 AM
No, I dont change it through the HMI. I tried to change the value through plc ( changing value) but it's not taking it. Actually the value changed over weekend, but it shows 3 (wednesday) today.
Title: Re: Day of week
Post by: franji1 on August 23, 2010, 08:51:49 AM
If you are using the DATE instruction in the PLC to set it via the HMI, you must also set the Day of Week value correctly (LOW BYTE in the LOW WORD, BCD).  You cannot set the V7774/V7773/V7772/V7771 values directly, those are READONLY and set by the PLC firmware from the time-of-day chip in the PLC hardware.  To set the time-of-day chip, you must use the DATE (and TIME) instructions.
Title: Re: Day of week
Post by: aw on August 23, 2010, 08:58:34 AM
all the Time?Date memory location are shown correctly. How do I write to V7771 ? Is there any sample program?
I am already using the one for synchronizing Date/Time with HMI.
Title: Re: Day of week
Post by: franji1 on August 23, 2010, 08:58:52 AM
Sorry - you are NOT using the HMI (my bad).  Just use DirectSOFT to set it.  Go online then do PLC->Setup->Calendar... and hit Get PC Time button then Write PLC, or just edit the fields by hand and then do the Write PLC.
Title: Re: Day of week
Post by: franji1 on August 23, 2010, 09:01:19 AM
That sample program is probably using the DATE and TIME instructions.  See what memory locations the DATE (and TIME) instructions are using.
Title: Re: Day of week
Post by: aw on August 23, 2010, 09:10:53 AM
YES !!  It did change to Monday. I never did it through Calendar, thinking that it's already done through HMI.
Calendar was showing correct date and time, so it didn't occur to me to write it to plc anyhow.
Thank you !!!
Title: Re: Day of week
Post by: franji1 on August 23, 2010, 09:16:45 AM
One question remains - are you using the HMI to synchronize your PLC date/time?
Title: Re: Day of week
Post by: aw on August 23, 2010, 10:04:40 AM
Yes, I am. Using the sample program and hmi clock set to read external.
Title: Re: Day of week
Post by: franji1 on August 23, 2010, 10:11:29 AM
Then there's something wrong - the HMI is not setting the day-of-week byte for the DATE instruction.  Find the DATE instruction in your program (Ctrl+F then enter DATE in the Find dialog), and export the entire rung logic that is using the DATE instruction, along with the V register value as a DWORD BCD in your 260 (e.g. DATE V2000, you would look at V2000 as a DWORD sized BCD/HEX in the Data View).
Title: Re: Day of week
Post by: aw on August 23, 2010, 10:31:52 AM
Here is a .gif attachement. Is there any other way to export just a few rungs to .txt file?


Title: Re: Day of week
Post by: b_carlton on August 23, 2010, 10:50:32 AM
This appears to have been done August 20th but there is no 'Day Of Week' (the low part of your V2052) set. it is left at zero (Sunday). The 20th was Friday so the low part should have been set to 5.
Title: Re: Day of week
Post by: aw on August 25, 2010, 10:46:53 AM
But the sample program does not have it.
How to do it?
Title: Re: Day of week
Post by: b_carlton on August 25, 2010, 11:01:36 AM
The documentation for the DATE instruction in the DL-205 manual shows the loading of the V registers including the day of week information. EXACTLY which 'sample program' are you referring to?
Title: Re: Day of week
Post by: aw on August 25, 2010, 12:28:10 PM
Example program which my coworker took from tech website, probably EP-MISC-001
Title: Re: Day of week
Post by: b_carlton on August 25, 2010, 12:53:30 PM
In that DST correction program the TIME command is being used not the DATE command.
Title: Re: Day of week
Post by: aw on August 26, 2010, 08:55:31 AM
I know, but since there is no example program for setting the date, we followed the TIME program. Except the Day of week does not work.
Isn't the internal clock calculating it?
Title: Re: Day of week
Post by: b_carlton on August 26, 2010, 09:42:03 AM
1. Follow the description for the DATE instruction in the CPU manual.

2. The DOW is not calculated. It is just incremented/cleared at midnight. You have to set it correctly either through Directsoft or via the DATE instruction.
Title: Re: Day of week
Post by: aw on August 26, 2010, 10:05:37 AM
Thank you.
I was missing DOW setpoint from HMI. Now that I added it everything works.