BLKMOVE for periphery words

lauwerstim

Member
Join Date
Apr 2006
Location
Kontich
Posts
93
Does anyone know how to do a BLKMOVE for periphery words.

I have a range periphery inputs that need copying:

This is how I would do it without the BLKMOVE, but it's a lot of typing:

Code:
L PID500
T DB60.DBD0
L PID504
T DB60.DBD4
...
L PID600
T DB60.DBD100

I have to do this 50 times, every time with a different destination. That's why I would like an easy way.

Thx in advance.
 
If the PI/PQ is in the local rack, then use SFC20.
Edit: I just remember that BLKMOV can only do that for the regular i/o that is part of the proces image. Not for i/o outside the proces image.

If the PI/PQ is via DP or PN, then use SFC14 to read and SFC15 to write blocks of periphery words.

For SFC20, SFC14 and SFC15 You use an ANY pointer to define the entire block to transfer.
 
Last edited:
.. or roll your own block move

Code:
FUNCTION FC 1 : VOID
TITLE =
VERSION : 0.1

VAR_TEMP
  iLoopCount : INT ; 
END_VAR
BEGIN
NETWORK
TITLE =
      OPN   DB    60; //db for storage
      LAR1  P#DBX 0.0; //start of storage
      LAR2  P#P  500.0; //start of peripheral area
      L     50; //no of dwords to xfer
LA:   T     #iLoopCount; 
      L     D [AR2,P#0.0]; //fetch pid[n]
      T     D [AR1,P#0.0]; //store in db
      +AR1  P#4.0; //index to next dword
      +AR2  P#4.0; //index to next dword
      L     #iLoopCount; //loop for count
      LOOP  LA; 
      SET   ; 
      SAVE  ; 
END_FUNCTION
 
A few things I just think of.

On most recent CPUs, you can adjust the size of the proces image. So if you only have to read the i/o once per OB1 scan then simply expand the proces image to suit.

But then, if this is just regular analog i/o that has to be scaled, why do you move the information from the PI to an intermediary address ?
That is a redundant step if you scale to engineering values anyway.
 
If the PI/PQ is in the local rack, then use SFC20.
Edit: I just remember that BLKMOV can only do that for the regular i/o that is part of the proces image. Not for i/o outside the proces image.

If the PI/PQ is via DP or PN, then use SFC14 to read and SFC15 to write blocks of periphery words.

For SFC20, SFC14 and SFC15 You use an ANY pointer to define the entire block to transfer.

I've tried SFC14 and 15 (it's virtual IO, comming from another PLC) and this doesn't work.

A few things I just think of.

On most recent CPUs, you can adjust the size of the proces image. So if you only have to read the i/o once per OB1 scan then simply expand the proces image to suit.

But then, if this is just regular analog i/o that has to be scaled, why do you move the information from the PI to an intermediary address ?
That is a redundant step if you scale to engineering values anyway.

It's not regular AI. It are signals comming from a slave PLC over Profibus IO.

I'll try then homebrewed BLKMOVE, looks nice, thanks.
 
This should work, even if it is i/o that is arriving in the CPU as slave from another CPU as master:
On most recent CPUs, you can adjust the size of the proces image. So if you only have to read the i/o once per OB1 scan then simply expand the proces image to suit.
 
This should work, even if it is i/o that is arriving in the CPU as slave from another CPU as master:

yes, that should. Only problem is that there are 40 slaves, each with 50 bytes to send and 50 bytes to receive and there's also a lot of local IO.

The homebrewed thingy works, so I'm already happy (y)

I would be thrilled if I can make it into an FC that I can call, but I can't pass a pointer to an entry in the FC (The DB I can)
 
Only problem is that there are 40 slaves, each with 50 bytes to send and 50 bytes to receive and there's also a lot of local IO.
What is the problem ? The PLC will automatically read the i/o for you. It will not burden the scan time any more than if you do it in code, probably less.
The homebrewed thingy works, so I'm already happy (y)
OK.
Besides, the adjustable proces image is only available in bigger CPUs or smaller CPUs of the latest versions.
 
Here's a more generalised FC to do the job:

Code:
FUNCTION FC 11 : VOID
TITLE =
VERSION : 0.1


VAR_INPUT
  pPeripheralBaseAddress : POINTER ;    
  pDBBaseAddress : POINTER ;    
  iNumberOfDwordsToCopy : INT ;    
END_VAR
VAR_TEMP
  iLoopCount : INT ;    
  iDB : INT ;    
END_VAR
BEGIN
NETWORK
TITLE =

      L     P##pPeripheralBaseAddress; 
      LAR1  ; 
      L     D [AR1,P#2.0]; 
      LAR2  ; 

      L     P##pDBBaseAddress; 
      LAR1  ; 
      L     W [AR1,P#0.0]; 
      T     #iDB; 
      OPN   DB [#iDB]; 
      L     D [AR1,P#2.0]; 
      LAR1  ; 
      L     #iNumberOfDwordsToCopy; //no of dwords to xfer
LA:   T     #iLoopCount; 
      L     D [AR2,P#0.0]; //fetch pid[n]
      T     D [AR1,P#0.0]; //store in db
      +AR1  P#4.0; //index to next dword
      +AR2  P#4.0; //index to next dword
      L     #iLoopCount; //loop for count
      LOOP  LA; 
      SET   ; 
      SAVE  ; 
END_FUNCTION
 
If the PI/PQ is in the local rack, then use SFC20.
Edit: I just remember that BLKMOV can only do that for the regular i/o that is part of the proces image. Not for i/o outside the proces image.

If the PI/PQ is via DP or PN, then use SFC14 to read and SFC15 to write blocks of periphery words.

For SFC20, SFC14 and SFC15 You use an ANY pointer to define the entire block to transfer.
ya it really works
i had tried
 
Here's a more generalised FC to do the job:

Code:
FUNCTION FC 11 : VOID
TITLE =
VERSION : 0.1


VAR_INPUT
  pPeripheralBaseAddress : POINTER ;    
  pDBBaseAddress : POINTER ;    
  iNumberOfDwordsToCopy : INT ;    
END_VAR
VAR_TEMP
  iLoopCount : INT ;    
  iDB : INT ;    
END_VAR
BEGIN
NETWORK
TITLE =

      L     P##pPeripheralBaseAddress; 
      LAR1  ; 
      L     D [AR1,P#2.0]; 
      LAR2  ; 

      L     P##pDBBaseAddress; 
      LAR1  ; 
      L     W [AR1,P#0.0]; 
      T     #iDB; 
      OPN   DB [#iDB]; 
      L     D [AR1,P#2.0]; 
      LAR1  ; 
      L     #iNumberOfDwordsToCopy; //no of dwords to xfer
LA:   T     #iLoopCount; 
      L     D [AR2,P#0.0]; //fetch pid[n]
      T     D [AR1,P#0.0]; //store in db
      +AR1  P#4.0; //index to next dword
      +AR2  P#4.0; //index to next dword
      L     #iLoopCount; //loop for count
      LOOP  LA; 
      SET   ; 
      SAVE  ; 
END_FUNCTION

Here's some example calls:

You trully are a Master plc programmer, thanks a lot. I'll test it on monday.

This is the greatest forum around. The answers I already found here are enormous.
Thanks to all.

ya it really works
i had tried
It didn't work for me, don't know why because I really tried it. Maybe I did something wrong. Will try testing it in the lab later.
 

Similar Topics

I am trying to copy settings from a DB that stores two different models worth of settings in it to a particular DB. This is how it works: I...
Replies
8
Views
2,747
Hi I am being given several fault words (as a DINT) from a Drive that I am receiving into a Compactlogix L33ER controller. I have a small...
Replies
12
Views
1,140
So I need to be able to give 10 people passwords to the machine and I need to make a log of when they are used. It's a Rockwell l71 processor and...
Replies
3
Views
885
The topic of reading or writing floating-point values via Modbus seems to come up regularly, and it is to my mind not that difficult. That said...
Replies
0
Views
1,387
I have a customer that has a GT1575-VNBA and I think they are using GT Designer. They have the software and program for both the HMI and the PLC...
Replies
3
Views
2,311
Back
Top Bottom