S7 SCL Date and time question

code

This is a little code how to convert to Integers:

Code:
      CALL  "READ_CLK"
       RET_VAL:=#FAULT
       CDT    :=#DATE_TIME              // 8 Byte's
      LAR1  P##DATE_TIME
      L     B [AR1,P#0.0]               // Byte 1
      BTI   
      T     #Year
      L     B [AR1,P#1.0]               // Byte 2
      BTI   
      T     #Month
      L     B [AR1,P#2.0]               // Byte 3
      BTI   
      T     #Day
      L     B [AR1,P#3.0]               // Byte 4
      BTI   
      T     #Hour
      L     B [AR1,P#4.0]               // Byte 5
      BTI   
      T     #Minute
      L     B [AR1,P#5.0]               // Byte 6
      BTI   
      T     #Second
      L     B [AR1,P#6.0]               // byte 7
      SRW   4                           // Delete Weekday part (4 bits)
      BTI   
      T     #mS
      L     B [AR1,P#7.0]               // byte 8
      SLW   12
      SRW   12                          // Delete mS part (12 bits)
      BTI   
      T     #Weekday

Weekday = 4 bits and mS = 12 bits. All together = byte 7 and 8.


hii i'cant read 7. byte day of week. i write this db1.dbb7 but i read mssecond ım not understand. how to do that?
 

Similar Topics

HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
82
Hi, I have an intermediate-advance knowledge of programming with TIA Porta in Ladder, would you recommend me to start learning SCL for it to...
Replies
11
Views
564
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
320
Hi everyone, I am new to this amazing world of PLC, well... I mean, in practice, since I already knew electronics, programming languages, IT, and...
Replies
7
Views
656
Hi all, This is my first post; I am new to PLC Controls stuff and English is not my native language, so I apologize in advance if something is...
Replies
4
Views
514
Back
Top Bottom