How do I set the time/date in TwinCat?

riahc3

Member
Join Date
Jul 2012
Location
Somewhere
Posts
16
I seem to have problems getting the time in TwinCat so I want to make sure the correct time is set.

Where can I set the time/date in TwinCat?
 
With a CX series controller, I have used 'NT_GetTime' to check the current time and used 'NT_SetLocalTime' to set the clock
 
This is for a CX9020 running CE on ARM.

In Windows it is set correctly but when I run a program in TwinCAT PLC Control, it comes out incorrect....
 
Last edited:
Tried this code:


Code:
(*Variables*)
GetRealTime:NT_GetTime;


GetRealTime();
GetRealTime.TIMESTR.wYear;
GetRealTime.TIMESTR.wMonth
GetRealTime.TIMESTR.wDay;
GetRealTime.TIMESTR.wHour;
GetRealTime.TIMESTR.wMinute;
GetRealTime.TIMESTR.wSecond;
GetRealTime.TIMESTR.wMilliseconds;

It gets me the time as soon as I run the program BUT doesn't update the time each cycle thru. New to this time of programming (sorry) so if someone could lend me a hand....
 
You will have to re-trigger the NT_GetTime function block by setting the START input high. In one of my applications, I have a pulse that is high for one scan every minute. This pulse is tied to the START input of the function block.
 

Similar Topics

Hello, I have an automation direct d2 262 plc and C-more HMI EA9T6CL-R. I need to prepare a program, scheduled to be performed on a future date. I...
Replies
1
Views
117
Hii everyone, I am having panel view plus 6 HMI I need to add date and time in Both plc and HMI. I know it's basic thing, Please help me to...
Replies
5
Views
1,722
I'm trying to set the date and time on a Panelview 600 plus 2711P-T6M20D8 SER A. I looked for a white square to pop up in the lower left...
Replies
6
Views
1,795
Hello Everyone I have a HMI Model - Model -GS2107-WTBD, HMI is n****e , While Downloading the Program to HMI the date & time getting Resetting...
Replies
3
Views
2,226
Hi, good day. I look for the way of set date from Factory Talk to RsLogix5000 tag. I was find a tag DateAndTimeString(Because only me useful...
Replies
8
Views
5,936
Back
Top Bottom