CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Tue Dec 18, 2018 3:52 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Sep 12, 2018 8:17 am 
Offline

Joined: Wed Sep 12, 2018 7:14 am
Posts: 3
Hi

I am trying to read out the current time and date and display it in
the visualization.
And here's my code:
The counter is increased every 500ms,
so every 3s I want to read out the actual time and display
it at the visualization. The code runs in cyclic task with 500ms cycle time.

For some reasons, I only get in the first cycle a date and time.
The output dtu_getdt.xDone will not reset even
if dtu_getdt.Execute is set back from TRUE to FALSE.
According to the library description the outputs should be reseted upon a
falling edge. I'm not sure whether this is the reason for executing it only once or not.

Using Codesys 3.5 SP11 Patch4+
RaspberryPi Runtime


VAR
dtu_getdt : DTU.GetDateAndTime;
dtDate : DATE_AND_TIME;
END_VAR

Codepart:
IF i_count1 > 5 THEN
dtu_getdt.xExecute := TRUE;
dtu_getdt();
IF dtu_getdt.xError THEN
; // Fehlerbehandlung
END_IF
IF dtu_getdt.xDone THEN
// ohne Fehler abgeschlossen
dtDate := dtu_getdt.dtDateAndTime;
dtu_getdt.xExecute := FALSE;
END_IF
i_count1 :=0;
END_IF
i_count1 := i_count1+1;

Thanks for any comments. I'm not a very experienced user.


Top
   
PostPosted: Wed Sep 12, 2018 10:08 am 
Offline

Joined: Fri Dec 26, 2014 3:10 am
Posts: 45
dtu_getdt();
IF i_count1 > 5 THEN
dtu_getdt.xExecute := TRUE;
IF dtu_getdt.xDone THEN
// ohne Fehler abgeschlossen
dtDate := dtu_getdt.dtDateAndTime;
dtu_getdt.xExecute := FALSE;
i_count1 :=0;
END_IF

IF dtu_getdt.xError THEN
; // Fehlerbehandlung
i_count1 :=0;
dtu_getdt.xExecute := FALSE;
END_IF

END_IF
i_count1 := i_count1+1;


Top
   
PostPosted: Wed Sep 12, 2018 7:16 pm 
Offline

Joined: Wed Sep 12, 2018 7:14 am
Posts: 3
Thanks a lot !!


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 6 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 Limited