Transfering 10 bytes of %I data into an FB

PLC

Member
Join Date
Sep 2002
Location
NC
Posts
311
Whats a nice way of transfering 10 bytes or x bytes of %I data (into the INPUT interface area) of an FB.
I then want to use it in the STAT area.

I would use just two variable input fields to the function block (both inputs)

I'm using an S7 300


This make any sense? :)
 
No. If it is in the INPUT area, why not use it from there ?

Can you write your functionality in pseudo code ?
 
I know I'm not being very clear.
Take a look at the doc, Am I just missing a simple concept?
I'm trying to create a Simocode FB where I pass Input data or a number for the I data into an FB (example a 10 would be IB10-IB19) then send it to the STAT area at some address (DIW 4 )inside my FB

Thanks for the reply!
 
If SimoCodeInputArea is the byte address of the first Input, then the following code could do it with the addition of a couple of TEMP parameters.

tSource as ANY
tDestination as ANY

Then in the code

Code:
LAR1 P##tSource  // Make AR1 point to tSource TEMP area
// Start building ANY address for Source

L W#16#1002    // S7 format in Bytes
T W[AR1, P#0.0]

L #No_Of_Bytes  // Number of Bytes to Transfer
T W[AR1, P#2.0]

L 0      // DB Address (Zero as Input Area)
T W[AR1, P#4.0]

L #SimoCodeInputArea // Start Byte Address
SLD 3  // Change to Pointer
L W#16#81000000  // Input Area
OD
T DW[AR1, P#6.0]

That sets up the input ANY pointer ready for a SFC20 block move.

For the destination, I would create a UDT of the data that comes from the drive and place that in the place of SimoCode Byte 1 etc.

So I would add

SimoCode as UDTx, where x is the UDT number for the drive data format UDT.

Also a couple of TEMPS

tDB as WORD
tAddress as DWORD

Code:
L P##SimoCode  // Get address data of SimoCode for ANY pointer
LAR1

L W[AR1, P#0.0]
T #tDB
L DW[AR1, P#2.0]
T #tAddress

LAR1 P##tDestination  // Make AR1 point to tDestination TEMP area
// Start building ANY address for Destination

L W#16#1002    // S7 format in Bytes
T W[AR1, P#0.0]

L #No_Of_Bytes  // Number of Bytes to Transfer
T W[AR1, P#2.0]

L #tDB     // DB Address 
T W[AR1, P#4.0]

L #tAddress// Start Byte Address
T DW[AR1, P#6.0]


Then do a call to SFC20.


Wish I had my S7 code at home to check the above, but think its the right direction.
 
PLC, the example you have shown has only 6 bytes in the STAT area, so a 10 byte transfer is not appropriate here.

How many different lengths of transfer do you require ?
 
L D
Thanks for the response
I realize the stat area is not complete. The
"Telegram" I am using for the Simocode is 10 Bytes input
Its really going to be fixed at that number
 
SFC14 and 15 only works when I set it up for consistence over total length
 
As you have a fixed 10 byte load/transfer, I would code it as follows:

Code:
FUNCTION_BLOCK FB 4
TITLE =
VERSION : 0.1

VAR_INPUT
  SimocodeInputArea : INT ; 
END_VAR
VAR
  SimoCodeByte0 : BYTE ; 
  SimocodeByte1 : BYTE ; 
  MotorkWH : INT ; 
  I_Max : INT ; 
  Posn : DINT ; 
END_VAR
BEGIN
NETWORK
TITLE =
      L     #SimocodeInputArea; 
      SLD   3; 
      LAR1  P#I 0.0; 
      +AR1  ; 
      L     B [AR1,P#0.0]; 
      T     #SimoCodeByte0; 
      L     B [AR1,P#1.0]; 
      T     #SimocodeByte1; 
      L     W [AR1,P#2.0]; 
      T     #MotorkWH; 
      L     W [AR1,P#4.0]; 
      T     #I_Max; 
      L     D [AR1,P#6.0]; 
      T     #Posn; 
END_FUNCTION_BLOCK
 

Similar Topics

AB 1200P 6181P Needing to transfer .cli file from one 1200P to another. I've loaded the file to the new one but it will not open. File name is KM...
Replies
0
Views
1,215
Hi guys. I am using RS Studio v24 and I have a structure BOOL[2048] inside. When I give project to our HMI designer he sees that array of bools...
Replies
6
Views
2,158
Hi, I've been trying to run my project in Simulation (and check display on VNC viewer). When I try to download a procjet to simulator, then I...
Replies
2
Views
1,496
Hi All, I've recently gained control of an existing control system used for purifying water. We have an SLC 5/05 processor and are using RSView...
Replies
8
Views
2,972
Everyone, So I have been on this forum for the last 24hours straight. I have learned a ton, like always. Yesterday I posted about resetting all...
Replies
1
Views
2,673
Back
Top Bottom