S7: Accessing P-Area by means of a pointer

pethoek

Member
Join Date
Apr 2009
Location
Järbo
Posts
105
I Need to copy 16 bytes (chars) from PIW-area and store in a DB. The PIW area contains a string received from 3:rd party device over profinet. (ABC Communicator, Modbus -> ProfiNet).

I Think i know how to construct the pointer, But what i don't understand is how the PLC determines if it is the PI or PQ area. I can only assume that this is determined by if it's a BLKMOV from or BLKMOV to operation ?

Please describe.

Find below my code, and please comment, or if there is a more direct, perhaps much easier way of doing this, please show how.

Best regards
Pethoek.


Code:
      LAR1  P##srcptr                   // Pointer Address
      L     W#16#1002                   // (10h always) + (02 for Byte)
      T     W [AR1,P#0.0]               // Store as offset W0 in pointer
      L     16                          // 16 Bytes to be copied
      T     W [AR1,P#2.0]               // Store as offset W2 in pointer
      L     0                           // Src is not a DB
      T     W [AR1,P#4.0]               // Store as offset W4 in pointer
      L     304                         // PI address to start copy from
      SLD   3                           // Convert to byte.bit address format
      L     DW#16#80000000              // 80H for P Area
      OD                                // Combine to memory area + address
      T     D [AR1,P#6.0]               // Store as offset DW6 in pointer
 
      CALL  "BLKMOV"
       SRCBLK :=#srcPtr
       RET_VAL:=#retVal
       DSTBLK :=P#DB77.DBX2.0 BYTE 16

( Yes, i know i need to add some more code, to make it a valid S7-String, but i left that part out so no need for commenting on that ) :D ;)
 
Last edited:
Hi!

I doubt you will get the BLKMOVE to work.

Snapshot from the HELP text:
Permissible source areas are the following:
· Parts of data blocks
· Memory bits
· Process-image partition (part process image) for inputs
· Process-image partition (part process image) for outputs


I think you should use DP_READ instead.
This will also only work if the DP area is consistent.

Kalle
 
You are correct i get error 8124 which tells me that the srcPtr is not valid.

I will try different apporach since i donät beleive in DP_READ either.
 
If the DP area is consistent(3 or >=5 bytes), you will have to use DP_READ.

If it is byte or (d)word consistent you can loop it out.

Or you could readress it to the PIA and loop it out from the IW area.

Kalle
 
I was thinking of the two latter methods, however, how do i point out the P-Area, My PLC goes to stop when trying this

Code:
      L     DW#16#80000000
      L     304
      SLD   3
      OD    
      LAR1  
      L     B [AR1,P#0.0]

Apperantly i'm not allowed to access the P-Area in the way i'm trying to.

The last way you mention, provide an example please

Best Regards
Pethoek
 
I was thinking of the two latter methods, however, how do i point out the P-Area, My PLC goes to stop when trying this

Code:
      L     DW#16#80000000
      L     304
      SLD   3
      OD    
      LAR1  
      L     B [AR1,P#0.0]
Apperantly i'm not allowed to access the P-Area in the way i'm trying to.

The last way you mention, provide an example please

Best Regards
Pethoek

Try this:
L 304
SLD 3
LAR1
L PIB [AR1,P#0.0]

===
What I meant with the last ex. was if you assign an address in the process image area (below PIW128 *) you can read the data with a L IWx loop. And you don't need to bother how the consistency is set.

Kalle

*) CPU and config dpendant.
 
Last edited:
You cannot use sfc 20 for periphery area. If you need consistent data use dp read and if not then you can use anypointer and loop to loop trough needed data.
 
KalleOlsen your example, shortened down to

Code:
      L     P#304.0
      LAR1  
      L     PIB [AR1,P#0.0]

Will also put PLC in stop, with I/O access Error when reading

So this way is also "forbidden"
 
Sorry... Same misstake again... I now know why the PLC goes to stop. I Have just set up the ABC-Communicator in the HW-Config. But i have yet not downloaded the configuration to the ABC itself. So at the moment there is no data to be read out.

I have done this before, and spent hours to figure out why it didn't work. Now again the same mistake. (I hop it is this that's causing the CPU -> Stop). I'll try download COnfig to ABC now.
 
All these methods now work after downloading configuration to the ABC module. Hope i'll remember this next time i use the ABC or any other Profinet I/O.

Code:
      L     PIB  304
      L     PIW  304
      L     PID  304
      L     DW#16#80000000
      L     P#304.0
      OD    
      LAR1  
      L     B [AR1,P#0.0]
 

Similar Topics

For the past few day, I have had problems accessing the Rockwell Knowledgebase. When I try to access it (and I do have a TechConnect Support...
Replies
7
Views
371
Hi, Small issue i've really been beating myself up over today. I've been working with Panelview panels for years. Currently working on an older...
Replies
1
Views
575
Dear experts, I have the following setup: CPU-313C (6ES7313-5BF03-0AB0 V2.6) + CP343-1 (6GK7343-1EX30-0XE0 V2.0) communicating with Siemens PC...
Replies
7
Views
2,635
I'm looking to replace an AB PanelView 600 2711-K6C2 HMI with a C-more EA9-T10WCL. The PLC in the system is a SLC 5/03, which is staying. I...
Replies
2
Views
1,231
Good afternoon everyone. I have an issue accessing IP ranges outside of the normal plant machinery range, but let me explain. For instance, our...
Replies
5
Views
1,762
Back
Top Bottom