DST

CAI_Support said:
Great, we just need to implement DSTON and DSTOFF IO identifier. Internally, we will store that into EEPROM each time being called. Then during power on, we will read back that bit.  If the bit is true, we will advance a hour. 
 
Maybe just call the identifier DST, so that when the date is true, PLC will call
SET DST 1
Then the date reached to turn off DST, PLC call
SET DST 0
 
That way, people from anywhere in the world can use your subroutine to set DST on or off accordingly.
 
 
While you're at it, please make CTS a WRITABLE as well as READABLE variable??
 
I've plenty of occasions where it would have been nice to be able to "update" the clock from an accurate source (when the WC board has no access to NTP, as happens in stand-alone situations).
 
CAI_Support said:
Great, we just need to implement DSTON and DSTOFF IO identifier. Internally, we will store that into EEPROM each time being called. Then during power on, we will read back that bit.  If the bit is true, we will advance a hour. 
 
Maybe just call the identifier DST, so that when the date is true, PLC will call
SET DST 1
Then the date reached to turn off DST, PLC call
SET DST 0
 
That way, people from anywhere in the world can use your subroutine to set DST on or off accordingly.
Fantastic. That would work great. It would be nice if the PLC could update itself, when the new code is available!
 
Mazeeff,
 
We have released firmware with DSTON support in 3.02.17c and later firmware.  This feature is NOT fully tested, because it depends on user to set PLC code to enable it.
Since DSTON feature will write to flash EEPROM chip, it will have write life 100,000 times by the chip manufacture. In normally use, if user only set once a year and  unset once a year,
that will take 50,000 year to wear out the EEPROM. However, if the PLC code having bug and setup this ON and OFF constantly, it will not take more than 5 minute to finish 100,000 times.
 
With that warning, lets discuss the DSTON feature.
In the general tab, there is now a DSTON checkbox.  That checkbox will add one hour to the clock when it is checked. When it is unchecked, it will not add one hour to the clock.
That is not really doing much.  For DSTON to work automatically, user must have 3.02.17c firmware and add PLC code.  As we have discussed in this thread, the differences in the whole
world on Day Light Saving is so different from country to country.  Not only that, congress keeps changing the Day Light Saving start and end date, too.  For the USA, the latest DST on and off
date is defined by US congress as:
"Starting in 2007, daylight time begins in the United States on the second Sunday in March and ends on the first Sunday in November. On the second Sunday in March, clocks are set ahead one hour at 2:00 a.m. local standard time, which becomes 3:00 a.m. local daylight time. On the first Sunday in November, clocks are set back one hour at 2:00 a.m. local daylight time, which becomes 1:00 a.m. local standard time."
 
To make it less CPU wasting, we check current day of the week is Sunday in the PLC code then going to the routine for further checking based on the above paragraph defined date.
 
START   

 TSTEQ CDW 0 
 CALLSUB CKDST  
 NOP   
 END   
 
CKDST:
 TSTNE CH 2 
 RET   
 TSTEQ CMONTH 3 
 CALLSUB CKDSTON  
 TSTEQ CMONTH 11 
 SET DSTON 0 
 RET   
CKDSTON:
 TSTGT CDAY 7 
 SET DSTON 1 
 RET 
 
This code is not fully tested. If the location you are in is not in USA, this PLC code may not work for you.  You will need to figure out the month and week for DST on and off for your region. If DSTON is already 1, keep setting that to 1 will have no effect, similarly if DSTON is 0, keep setting that to 0 will not harm the chip. Only keep setting it to 1 then 0, then 1, then 0, will actually write to eeprom.
 
Excellent news. The code looks fine, and it would be easy for me to add 10 years of dates in less than 30-40 lines of code. The support you folks give to this product is fantastic!
 
Yes, to get this new feature, the board need to be re-programmed by returning to our office.
You will also need to have PLC code to set it on and off at certain date of the year for your location.
 
Back
Top