Real Time Clock in Schneider M340 PLC

Join Date
Sep 2018
Location
Chittorgarh
Posts
22
I have a system installed in my company which have M340 PLC and it has a program which is used toh turn lights on and off. I am attaching program pic for reference. Now I have to change on/off time can anyone tell me how the time conversion works here.
Here time reads with %SW51 and it is defined as int data type.
 
Last edited:
There are easier ways to do this with function blocks in the library. Attached is a picture of the different realt time clock function blocks

rtc.JPG
 
It can be configured to use a time server, but it only accepts IP addresses.
Because of this, I wrote a script in the hmi to update the plc clock.
 
RTC_Compare:= EQUAL_ARINT(Hours_6,Hour_memory_6);
(*EQUAL_ARINT(Hours_6,Hour_memory_6) > -1*)
IF (RTC_Compare > -1) THEN (*if time/date set words were changed, then set clock*)

SET(%S50);

%SW50 := INT_TO_BCD(Hours_6[2] * 100);(*seconds*)
%SW51 := INT_TO_BCD((Hours_6[0] * 100) + Hours_6[1]);(*hours and minutes*)
%SW52 := INT_TO_BCD((Hours_6[3] * 100) + Hours_6[4]);(*month and day*)
%SW53 := INT_TO_BCD(Hours_6[5]);(*year*)


ELSE (*if no change in set words, just update them to the clock values*)
(*display hh mm ss mm dd yyyy MW2161-MW2166 *)
Hours_6[0] := BCD_TO_INT(%SW51 / 256);(*hours*)
Hours_6[1] := BCD_TO_INT(%SW51 MOD 256);(*minutes*)
Hours_6[2] := BCD_TO_INT(%SW50 / 256);(*seconds*)
Hours_6[3] := BCD_TO_INT(%SW52 / 256);(*month*)
Hours_6[4] := BCD_TO_INT(%SW52 MOD 256);(*day*)
Hours_6[5] := BCD_TO_INT(%SW53);(*year*)
IF (%S50) THEN
RESET(%S50);
END_IF;
END_IF;

Hour_memory_6 := Hours_6 ;(*set memory words to detect any change next scan*)
 

Similar Topics

Hello. This is one for the Mitsubishi experts. I need to measure the time for a remote device's to return process data sent from the i-QR...
Replies
17
Views
2,098
Hi all I thought I had this working but upon doing a checkup a few months after the machine was commissioned, I found that adjusting the RTC via...
Replies
4
Views
1,841
hi all i have used a real time clock to turn on a bit after 1 month. the plc was off for this whole month and when i turned on the plc after a...
Replies
2
Views
1,413
hey, anyone know how to export time from panelview 800 to micro 850 and to compare time? or distinguish various time , like to know which shift...
Replies
1
Views
1,436
Hi again Looking to write date or time values to the RTC in my MicroLogix 1400 In the ladder logic I am using a CPW instruction as per the 1400...
Replies
13
Views
3,212
Back
Top Bottom