Tia portal local temp in OB

rQx

Lifetime Supporting Member
Join Date
Oct 2010
Location
Trelleborg
Posts
1,051
Hi!
Straight up Q. If I declare a local temp in say OB1, can I use it in OB2, or it just work in the same OB?
 
I'm not too sure about TIA, however, these memories are usually assigned at compile time so declaring a local variable (temp) means exactly that.
It will be a physical memory location but as a tag it will not be exposed to other blocks i.e. as TIA can be tag based as well as actual memory based so declaring a tag only will not be available to other blocks. It depends on how the Mfg. uses actual memory for example in Mitsubishi all variables are actual addresses i.e. "D" (Word, double, reals), "M" (Bit) the compiler is assigned blocks (usually in the higher ranges) as temps so although in general, these will be unique, can be re-used as temps so may be overitten, however this rarely happens. plus as these variables are tag (symbolic) cannot be accessed outside of the block it is assigned too. So in short, NO IT CANNOT BE USED IN ANOTHER BLOCK, unless you use a real memory tag. (Most systems will not allow you to assign a symbol twice). For clarity to use a variable tag in multiple blocks it has to be assigned as a global.
 
It has nothing to do with the blocks, it's the IEC convention that has decided the approaches to coding, The idea was to bring harmony to the industry, with the possibility of making code transportable these are the reasons for a number of conventions i.e. FC's FB's, local variables, symbolic addressing rather than actual physical & of course ST.
However, there are differences like some special cards that need in-built function blocks that will only work on that hardware. However, many special add on cards are now set up with utilities in the IDE so no PLC code is required to make them work, this frees up the differences between platforms to some extent.
By going to symbolic addressing means the code on one type can be compiled in another as it is the compiler that allocates the physical addresses, however, there are still some manual mods that need to be done regarding the I/O addressing for example Mitsubishi use X & Y, CLX uses I/O, and of course there are others.
 
Last edited:
With a S7-300/400 you can get access to the localdata of the predecessor by indirect addressing, for example if FC1 calls FC2 then FC2 could access the local data of FC1, but not from a completely different OB.
 

Similar Topics

Hello everyone, I'm working on Step 7 Pro (TIA Portal), I would like to change the local time (GMT offset and Summer/Windter) of a S7-300 CPU...
Replies
3
Views
5,022
Hello, i am using profibus as communication between plc and fanuc arm. I can easily send inputs from plc to arm, but i can't monitor any outputs...
Replies
0
Views
35
Hello, I need to write the following program in Ladder language, but I could not integrate the Fibonacci sequence into the ladder. Can you help...
Replies
20
Views
340
Hi All, Someone at work has put a PLC system on my desk, that's just been taken off an idle production line. He said "It's an S7 PLC. We don't...
Replies
10
Views
273
Hi guys , I'm new with Allen Bradley, but I have experience with Tia portal (s7 1200 ,s7 1500) I want to convert my project from Tia portal to...
Replies
2
Views
214
Back
Top Bottom