Simatic S7-1200 SCL Indirect Addressing

Jarvis

Member
Join Date
Dec 2014
Location
XXX
Posts
3
Hello,
I am currently forced to use s7-1200 (6ES7214-1AG40-0XB0) PLC for one small project. I do have some experience with S7-300/400 mostly in STL (+Step7), which is (sadly) not available on S7-1200.

Here is my problem:
- I have a Data Block in which AIN_UDT(s) are placed, the DB is structured as follows:
DB_AIN
AIN_001_TemperatureRoom1
AIN_002_TemperatureRoom2
...
AIN_XXX_XXX

- I do not use array because I need to see AIN name (AIN_001_TemperatureRoom1) in the program
- I would like to have a Function (FC), which will do the AIN processing
- My idea is to use SCL and have a for cycle, something like this:
FC_AINProcessing

Temp AIN_temp of type AIN_UDT

For i:=0 to NUMBER_OF_AINS

// copy UDT from DB_AIN to AIN_temp
// do the proccesing (limits, alarms, ...)
// copy AIN_tmp back to DB_AIN

End For

Sadly I am not able to make it work (on S7-300/400 with STL it is really simple...). Can you, please, help me with this / recommend some good manual describing indirect addressing in SCL...?


Thanks in advance!
 
Hello,
With arrays it is easy...without You can try
PEEK: Read memory address/POKE: Write memory address instructions...(Standard DB)
or "manually"copy UDT see attachement....
 
The "POKE_BLK" function solved my problem!

Thanks a lot!

PS: Still "fighting" with TIA14, optimized DB, SCL, ...
 
PS: Still "fighting" with TIA14, optimized DB, SCL, ...

For what it's worth, the "optimized" way of doing it is with the indirect addressing. if you want the pointers, you need to use standard.

Personally, I prefer arrays. I think seeing TempRoom[1] in the code is just as clear as TempRoom1, and it allows you to access the data in the structure much more easily.

I might be biased, though, as I also think pointers are messy. They're powerful, admittedly, but the code is usually much harder to read, and takes a lot more space to do the same function. It's also much easier to make mistakes.
 
...Personally, I prefer arrays. I think seeing TempRoom[1] in the code is just as clear as TempRoom1, and it allows you to access the data in the structure much more easily.


But inside of an array, each element has the same name, which is a big disadvantage for me...Imagine a DB_AIN i which all measurements are stored. This DB_AIN is processed (limits, ...) by FC_AIN - in FC_AIN it would be fine to use array access since it does just some processing, but when I access some AIN inside of a program, I need to know the exact (technological) name of this AIN so I can find it technological scheme and so on...

On the other side, I agree that indirect addressing and pointers produced code that is much harder to read (but still it is very powerfull tool).
 
But inside of an array, each element has the same name, which is a big disadvantage for me...Imagine a DB_AIN i which all measurements are stored. This DB_AIN is processed (limits, ...) by FC_AIN - in FC_AIN it would be fine to use array access since it does just some processing, but when I access some AIN inside of a program, I need to know the exact (technological) name of this AIN so I can find it technological scheme and so on...

On the other side, I agree that indirect addressing and pointers produced code that is much harder to read (but still it is very powerfull tool).

I'm still confused on how the naming scheme is so different.

So the tag would be DB_ain.temproom[1].structure.data.tag vs DB_ain.temproom1.structure.data.tag?

Edit: looking at the original post, I guess your tag name also has the number in the middle of the tag, I guess that would make arrays not match exactly if you're stuck to the existing naming scheme
 
Last edited:

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
63
Good Evening , It has been several years since I used Siemens Software . I’m looking to purchase the software for a Siemens Simatic S7...
Replies
4
Views
487
Hello.We are trying to convert a program written with S7-300 Simatic Manager to S7-1200 V16.Unfortunately, there is only LAD,FBD option in S7-1200...
Replies
2
Views
746
I have new Siemens PLC / Simatic S7-1200 Need software download to use the PLC Please advise Thanks Wally
Replies
8
Views
2,226
I have new Siemens PLC / Simatic S7-1200 Need software download to use the PLC Please advise Thanks Wally
Replies
1
Views
639
Back
Top Bottom