Thanks again for your answer but the idea is to have the current time and to see it change. Is there a simple solution in simulation mode or is there a solution to test without having the material (use my computer as a platform)
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-02-11
Originally created by: crthomas1234
The RTC libraries can access the RTC on your PC.
I like to use the internal function: SysTimeGetDate found in the SysTime.lib.
This function returns a structure of type SYSTIMEDATE. Inside this structure, all of the sub-elements such as year, day, hour, minute, second, etc are already broken out for you to access so you do not have to parse the time string that is returned by some of the other blocks.
The SysRtcGetTime() returns a time that is referenced from an initial input time setting. The default value for this initial time is the 1970-01-01-00:00.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I'm a new user of CoDeSys and I try it on my PC before to use it on "real" on a PMA system (KS128).'m in simulation mode.
I'm trying to get the current date and time and it's not realy succesful
and I get for test the value DT#1970-01-01-00:00 in spy mode
Please help
Thanks
Hi,
the value is correct. what you see is the default value.
the SysRtcGetTime function won't work in simulaton mode,
because you have no access to the controllers realtime-clock.
greets Volker
Thanks NITROZIN,
The new question is How can I have the current date and time in simulation mode ? I need it to make the test of my FB.
Thanks
hi,
it's really easy.
first create a variable with DT format.
use this variable instead of the GetSysRtc-output for testing the input of your FB.
run your program and make a doubleclick on the variable you want to change (My_DT).
you get a window for changing the value.
greets Volker
Thanks again for your answer but the idea is to have the current time and to see it change. Is there a simple solution in simulation mode or is there a solution to test without having the material (use my computer as a platform)
Thanks
hi again,
you can use the external librarys only with the target system.
for testing the date & time functions use the RTC FB from the standard.lib
this should work
greets Volker
Thanks a lot for your help
Originally created by: crthomas1234
The RTC libraries can access the RTC on your PC.
I like to use the internal function: SysTimeGetDate found in the SysTime.lib.
This function returns a structure of type SYSTIMEDATE. Inside this structure, all of the sub-elements such as year, day, hour, minute, second, etc are already broken out for you to access so you do not have to parse the time string that is returned by some of the other blocks.
The SysRtcGetTime() returns a time that is referenced from an initial input time setting. The default value for this initial time is the 1970-01-01-00:00.