CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version Spanish version French version
It is currently Thu Apr 24, 2014 3:24 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: System time
PostPosted: Thu Dec 15, 2005 6:12 pm 
Offline

Joined: Thu Dec 15, 2005 6:08 pm
Posts: 5
Location: Novi Sad, Serbia
Please help.

I don't know how to read System date and time. I supose that SysLibTime.lib is answer but I don't know how to use this library.
I would like to set value in variable X of system date and time in ST.

Thanx.
:)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 16, 2005 4:20 pm 
try

ActDateAndTime := SysRtcGetTime(dummy);

with ActDateAndTime as DT
and dummy as BOOL.
SysRtcGetTime ist a function from SysLibRtc.lib


Top
  
 
 Post subject:
PostPosted: Sun Dec 18, 2005 5:22 pm 
Offline

Joined: Thu Dec 15, 2005 6:08 pm
Posts: 5
Location: Novi Sad, Serbia
Thanx for reply but I don't have library SysLibRtc.lib.

I search whole 3s folder but cannot find it. Can you post it here or mail it to me? Please? :D

Maybe some other way?
Please help my deadline is comming...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 12:40 pm 
Offline
Site Admin

Joined: Wed Jul 20, 2005 2:32 pm
Posts: 132
Location: Smolensk, Russia
cica_draza wrote:
... I don't have library SysLibRtc.lib.


Indeed, System Libs are external libraries with realizations inside runtime system.

If yours PLC has RTC and manufacturer (OEM) support appropriate library then CoDeSys Library Manger will discover SysLibRtc.lib without any trick.

OEM may develop specialized library for system time access.

The questions are:
Does yours PLC have RTC hardware?
How OEM supports the RTC?

_________________
_IP_


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 3:40 pm 
Offline

Joined: Thu Dec 15, 2005 6:08 pm
Posts: 5
Location: Novi Sad, Serbia
I'm just a student and I don't have PLC.

I'm doing some project for my exam and I need to make ST program only for virtual PLC.

I have ST program, visualization and that's it. :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 21, 2005 7:01 pm 
Offline

Joined: Thu Dec 15, 2005 6:08 pm
Posts: 5
Location: Novi Sad, Serbia
I realize it! :)


It is simple. :)

Just used RTC block.
It has 4 variables:
enable
InputDateAndTime as DT
Q as bool
OutDateAndTime as DT

As soon as EN becomes TRUE, the time of InputDateAndTime is set, is counted up in seconds and returned in OutDateAndTime as long as EN is TRUE. As soon as EN is reset to FALSE, OutDateAndTime is reset to the initial value DT#1970-01-01-00:00:00.

InputDateAndTime can be left out and than time and date are readen from the System.

Finally. :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 5:11 pm 
Offline
Site Admin

Joined: Wed Jul 20, 2005 2:32 pm
Posts: 132
Location: Smolensk, Russia
You are right. It is good solution for emulation mode.

:idea: By the way, you may download our free TimeExp.lib http://www.prolog-plc.ru/docs/timeexp.zip includes effective date and time manipulation functions.

_________________
_IP_


Last edited by Igor Petrov on Fri Jan 13, 2006 2:03 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 12, 2006 2:23 pm 
Offline

Joined: Thu Dec 15, 2005 6:08 pm
Posts: 5
Location: Novi Sad, Serbia
Thanx :)

I have downloaded but I have a problem. I don't know Russian (only few words I know are something like ya tebya lyublyu for my girlfriend :))
Big procent of that lib I figured out what is going on inside but not all.

have you some version in english?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 2:00 pm 
Offline
Site Admin

Joined: Wed Jul 20, 2005 2:32 pm
Posts: 132
Location: Smolensk, Russia
Indeed the project was an appendix for our rather big article in Russian . It would be rather difficult to translate it to English completely :? .
The project file comments translation would bring you nothing since the library includes the same functions with English comments.

Main functions:

    ExtractDate Input: DATE; Output: year, month, day of the month
    ExtractTime Input: TIME; Output: hour, minute, second, ms
    PackDate Input: year, month, day of the month; Output: DATE
    PackTime Input: hour, minute, second, ms; Output: TIME

    CONCAT_DATE_TOD Input: DATE, TIME_OF_DAY; Output: TD
    DiffTOD Input: TOD1, TOD2; Output: TIME
    ExtYear Input: UINT 2 digits year; Output: UINT 4 digits year
    IsLeapYear Input: UINT year; Output: BOOL
    WeekDay Input: DATE; Output: UINT weekday number
    fbRTC standard RTC realization example, based on TON


Outer functions are only auxiliary for main functions.
Conversions based on fast algorithms without cycles.

Just tell me if you have problems to understand some functions or algorithms. I will try to describe it in details.

_________________
_IP_


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group