S7 Pointer head ache

Matchu04

Lifetime Supporting Member
Join Date
Mar 2013
Location
Northampton
Posts
287
Afternoon guys / gals

I was wondering if someone could have a quick look at this for me. Up until now I thought I had reasonible understanding of pointers but this has got me stumpped.

Basically the load command in read are loading different values into the accum 1 but I cant seem to locate the source. For example In the picture P#22.0 is being called which loads a value of b0, but in the DB75.db22.0 is byte B#10#0 and in the IDB the value of 22.0 is a boolean...

Could someone piont me where I am going wrong please....

Diverter.jpg
 
I think that PROGRAMDATEN do not start at 0.0, but somewhere down in the declaration part. It is not easy to see in the screenshot, but if I am not mistaken 850004b0 should mean byte 150 in the IDB.
So instead of byte 22, you should look at 150+22 = byte 172.

Btw. I hate this way of programming.
 
You want to see our pasteurisers... they are even worse!!

The problem is the IDB doesnt have 172 bytes, only goes upto 78..
Thank you for a quick response btw!! ???
 
I think that the 850004b0 I quoted is wrong.
Like I said. It is almost impossible to see in the screenshot.

This is better I think:
After initialising AR1 in line 2 the content is DI 22.
After adding 22.0 to it, it becomes DI 44.
So it is byte 44 you have to look at.
 
On the right, you have the online status window.
Find the one with header AR1.
Look at it's status/value.
 
S7 Pointers

GDay

I think a really good way to learn about s7 pointers is to put the program into the simulator and single step through it while monitoring at contact then you can watch the AR registers etc - takes the guesswork out of it!

Common pitfalls are that the number of bits go over the integer length of 32767 so use the load double commands..its a pitfall because it works at first but then you get up to those further down recipes and...

Hope this helps

Rgds
David
www.fast-automation.com
 
Based on the merkers M183.1, M183.2 and M183.3 one of 3 boolean conditions shall be combined with #PROGRAMDATEN.GEBINDE_VOR_DV_QUER to control the BOOL #VORB_DV_EIN.

Surely that must have been possible to do without resorting to pointers, jumps, and absolutely specified offsets.
Thats important to learn. When to use pointers. IMO is rarely as possible.
Unless the purpose is to obfuscate how the program works.
 
Good evening all, sorry for the late reply.... I finally have a better understand what is happening in this program but now I am faced with the next problem.... resolving it...

This program controls an arm on a packer divider that twists certain packs within a layer formation. I believe the problem is when the different layer format is selected in the program. There must be 1 scan cycle during the change that causes the arm to go in and then come flying out on a occasions knocking the next pack.

By the looks of it, it may have always been like this but I am determined to resolve it if possible but another opinion would be greatly appreciated.

I will post the FB up tomorrow for you who wish to have a look.
 
I think that the 850004b0 I quoted is wrong.
Like I said. It is almost impossible to see in the screenshot.

This is better I think:
After initialising AR1 in line 2 the content is DI 22.
After adding 22.0 to it, it becomes DI 44.
So it is byte 44 you have to look at.

Yeah I realised this but I knew where you was heading....
 
Based on the merkers M183.1, M183.2 and M183.3 one of 3 boolean conditions shall be combined with #PROGRAMDATEN.GEBINDE_VOR_DV_QUER to control the BOOL #VORB_DV_EIN.

Surely that must have been possible to do without resorting to pointers, jumps, and absolutely specified offsets.
Thats important to learn. When to use pointers. IMO is rarely as possible.
Unless the purpose is to obfuscate how the program works.

These markers are selecting the layer format / patterns
 
As promised please find attached a copy of the blocks

.. FB124 is the diverterblock
.. FB50 is where it is called from

Thanks again guys
 

Similar Topics

I have a word in some DB which I want to load to AR1 and use as a pointer. In order to do this I need to write L DBxy.DBW xy SLD 3 LAR1 I...
Replies
3
Views
526
I am trying to access the value of a pointer via OPC UA in Codesys. I can share it directly and in a struct but I cant access the value of it when...
Replies
5
Views
1,596
Why does my deconstruction of the input pointer only work with its own instance DB not inside the multi instance FB...See .doc The pointer at the...
Replies
8
Views
2,329
Hi All, in many library function of TiaPortal some data must be write using the pointer format........ eg.: P#DB90.DBX0.0 WORD 10 is it...
Replies
5
Views
2,817
I have a very strange issue and I cannot figure out why it is not working. I read input of type pointer and store it to local temp type any. I...
Replies
4
Views
1,922
Back
Top Bottom