Siemens S7, DT

tomhelliwell

Member
Join Date
Feb 2008
Location
Sheffield
Posts
25
Hi All,
I have a problem with Siemens S7, I have created a FC that generates a DT. The problem is I can't seem to fugure out how to return the DT.

I have attached a Screenshot to show what I mean.

Thanks

Tom

Untitled.jpg
 
Indirect addressing required. Add the following code to the end of your block, and add "outdb" as an INT to your temp area.

Code:
      L     P##DTOUT
      LAR2  
      L     W [AR2,P#0.0]
      T     #outdb
      L     D [AR2,P#2.0]
      LAR2  
      OPN   DB [#outdb]
      LAR1  P##DT_1
      L     D [AR1,P#0.0]
      L     D [AR1,P#4.0]
      T     D [AR2,P#4.0]
      TAK   
      T     D [AR2,P#0.0]
 
I think that "DT" is just a shorter way to write DATE_AND_TIME.
Create a variable in a global DB with type DATE_AND_TIME.
Your BLKMOV can then point to the variable. Just type the symbolic name, i.e. "MyDB".My_DT_var
 
@L D[AR2,P#0.0]

You also need to check that outdb is not zero, and when it is, not open the db! And that when di is accesed you need to use opn di or replace the di address marker with the one for a db!
 
Last edited:
And that when di is accesed you need to use opn di or replace the di address marker with the one for a db!

No. A DT data type parameter is passed to an FC as a DB pointer. Even if the calling block is an FB and the DT is in the STAT area, the db pointer passed will contain a global DB number and the absolute address of the STAT variable.
 

Similar Topics

Hello everyone, I've had this issue for the last 2 days where I try to assign the profisafe address to an IO block (6ES7 146-6FF00-0AB0) but when...
Replies
5
Views
83
Hello, good morning, I have been having two problems with the Tia Portal software. The first is that I have installed it on my computer and...
Replies
5
Views
138
Hello to all, I'm just starting with using CodeSys. Immediately, I have noticed that Codesys doesn't use data blocks like for example S7 does...
Replies
11
Views
167
Hi, I'm setting up a modbus master on an S7-300. It seems to work in OB1 but not when I use it in OB35. Does anyone have any ideas why? Could...
Replies
10
Views
111
The past week we received a new piece of equipment from Germany which utilizes siemens controls. Typically in our company we use A.B. controls for...
Replies
12
Views
330
Back
Top Bottom