This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.  
Your Personal PLC Tutor Site - Interactive Q & A

"real time clock s7 315-2 plc"

New Here? Please read this important info!!!
Email this topic to a friend
Printer-friendly version of this topic
Archived thread - Read only 
Previous Topic | Next Topic 
Home Conferences *** LIVE PLC Q&A *** (Public)
Original message

PLucas Click to view user profile - (8 posts) Click to check IP address of the poster Feb-13-02, 11:20 AM (EST)
"real time clock s7 315-2 plc"
I am trying to read the real time clock from an S7 315-2 PLC, using SFC1, unfortunately, I cannot get the syntax right for the CDT output, I want to place the time into a data block (DB10) so that I can use it within my program. Can anybody tell me what form the syntax needs to take to place the time into DB10.
  Top

 Table of contents

RE: real time clock s7 315-2 plc, rsdoran, Feb-13-02, (1)
RE: real time clock s7 315-2 plc, PLucas, Feb-14-02, (2)
RE: real time clock s7 315-2 plc, cods, Feb-14-02, (3)
RE: real time clock s7 315-2 plc, cods, Feb-14-02, (4)
RE: real time clock s7 315-2 plc, PLucas, Feb-14-02, (5)
RE: real time clock s7 315-2 plc, jvdcande, Feb-14-02, (6)
RE: real time clock s7 315-2 plc, PLucas, Feb-15-02, (7)

Lobby | Topics | Previous Topic | Next Topic
Messages in this topic

rsdoran Click to Email rsdoran - (444 posts) Click to check IP address of the poster Feb-13-02, 02:13 PM (EST)
1. "RE: real time clock s7 315-2 plc"
just curious, did you use D_TOD_DT to create the data type DT? Then used SFC0 SET_CLK to set the time date. Its entered as: DT#2002-02-13-11:20:30 Feburary 13,2002 11:20 a.m. and 30 seconds..I used your post time as an example.

Hopefully someone else will step in soon and assist, I am reluctant to go further. I have only done it once and know you have to do the above first, have to locate that file to see what came next. Will be back later with more if needed.

  Top

PLucas Click to view user profile - (8 posts) Click to check IP address of the poster Feb-14-02, 03:10 AM (EST)
2. "RE: real time clock s7 315-2 plc"
LAST EDITED ON Feb-14-02 AT 03:43 AM (EST)

I set the time and date in the hardware setup, if I check this when on line the time and date are correct. I did not use D_TOD_DT to create the data type DT, I will give that a go and see what happens.
I tried to use FC3 (D_TOD_DT), but I cannot get the syntax right for the RET_VAL output on this block either. Seimens help files on this are not that good, showing an example would be more helpful. This is my first attempt at using S7 300 PLC's, Also this is the first time that I have had to right a progam that proforms certain functions dependent on the time of day. unfortunately I have plenty of experience with GE series six and S5 plc's, but S7 seems a bit of a grapple at times to me.

  Top

cods Click to Email cods - (1 posts) Click to check IP address of the poster Feb-14-02, 06:25 AM (EST)
3. "RE: real time clock s7 315-2 plc"
Hi there,
I have done this myself & found that you can send the CDT output to a pointer address area e.g. a data block, although the value cannot be monitored there.
The syntax for a pointer address is p#db0.dbx0.0, where db0 is the db number & dbx0.0 is the address area within the data block.
I have found that the easiest way to do this is to first create the data block with data of the type DATE_AND_TIME & save this.
Also save the data block in the Symbol Table, then at the CDT output enter the code symbolicly.If the data block was saved as DATA_BLOCK in the symbol table & the data was named TEST then the code at the CDT output would be "DATA_BLOCK".TEST

Alternatively the data at CDT can be sent to a declaration of the type DATE_AND_TIME & the the declaration can be used as the input of FC6 DT_TOD,FC7 DT_DAY or FC8 DT_TOD.
I hope this is of some help.
Cods

  Top

cods Click to Email cods - (1 posts) Click to check IP address of the poster Feb-14-02, 06:27 AM (EST)
4. "RE: real time clock s7 315-2 plc"
Sorry FC6 is DT_DATE.
  Top

PLucas Click to view user profile - (8 posts) Click to check IP address of the poster Feb-14-02, 11:57 AM (EST)
5. "RE: real time clock s7 315-2 plc"
Thanks for that. I will now give that a go and see how I get on with it. I'm sure I will be back for more.
  Top

jvdcande Click to view user profile - (5 posts) Click to check IP address of the poster Feb-14-02, 02:59 PM (EST)
6. "RE: real time clock s7 315-2 plc"
The DATE_AND_TIME variable you get out of SFC1 is an 8-byte variable. Since the S7 PLC's can only handle 4-byte variables directly, you cannot monitor the PLC clock directly.

However, if you know how this variable is constructed, it is quite easy to monitor.

The DATE_AND_TIME variable consists of 8 bytes of data in BCD format, used as follows:











ByteContentRangeComment
0Year1990...2089Without century
1Month1...12
2Day1...31
3Hour0..23
4Minutes0...59
5Seconds0...59
6+7(upper half)Milliseconds0...999
7(lower half)Weekday1...71 = Sundag

Since you can monitor bytes, words and doublewords in hexadecimal format, you can monitor any of these data.

If your data is located at, say DB10, starting at byte 0, then read DB10.DBB0 to see the year, DB10.DBB1 to see the month and so on. Of course, to get the milliseconds or the weekday, you have to perform some bitfiddling.

Good luck,

Jean Pierre Vandecandelaere
Instructor PLC - SCADA
VDAB Brugge
Belgium

  Top

PLucas Click to view user profile - (8 posts) Click to check IP address of the poster Feb-15-02, 08:40 AM (EST)
7. "RE: real time clock s7 315-2 plc"
Guy's
Thanks for your assistance in this little problem, I am now getting somewhere with my program.
  Top


Remove

Lobby | Topics | Previous Topic | Next Topic
Rate this topic (1=skip it, 10=must read)? [ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 ]
Your Personal PLC Tutor Site Learn Now!!.