You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old April 7th, 2010, 05:49 PM   #1
PLC
Member
United States

PLC is offline
 
Join Date: Sep 2002
Location: NC
Posts: 206
Transfering 10 bytes of %I data into an FB

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?
  Reply With Quote
Old April 7th, 2010, 05:53 PM   #2
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 5,579
No. If it is in the INPUT area, why not use it from there ?

Can you write your functionality in pseudo code ?
  Reply With Quote
Old April 7th, 2010, 06:31 PM   #3
PLC
Member
United States

PLC is offline
 
Join Date: Sep 2002
Location: NC
Posts: 206
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!
Attached Files
File Type: doc Simo.doc (116.0 KB, 26 views)
  Reply With Quote
Old April 7th, 2010, 07:03 PM   #4
TurpoUrpo
Lifetime Supporting Member
Finland

TurpoUrpo is offline
 
Join Date: May 2008
Location: Finland
Posts: 1,451
Why you want it to stat area?

OT: use alt + printscrn to get screenshot from only active window.
  Reply With Quote
Old April 7th, 2010, 07:47 PM   #5
PeterW
Member
Canada

PeterW is offline
 
Join Date: Jun 2006
Location: Edmonton
Posts: 2,517
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.
  Reply With Quote
Old April 8th, 2010, 03:43 AM   #6
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 5,579
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 ?
  Reply With Quote
Old April 8th, 2010, 07:22 AM   #7
JRW
Member
United States

JRW is offline
 
JRW's Avatar
 
Join Date: Jun 2002
Location: Upstate South Cackalacky
Posts: 1,682
Will a sfc14 15 work

Last edited by JRW; April 8th, 2010 at 07:24 AM.
  Reply With Quote
Old April 8th, 2010, 07:30 AM   #8
PLC
Member
United States

PLC is offline
 
Join Date: Sep 2002
Location: NC
Posts: 206
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
  Reply With Quote
Old April 8th, 2010, 07:34 AM   #9
PLC
Member
United States

PLC is offline
 
Join Date: Sep 2002
Location: NC
Posts: 206
SFC14 and 15 only works when I set it up for consistence over total length
  Reply With Quote
Old April 8th, 2010, 08:57 AM   #10
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 5,579
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
  Reply With Quote
Old April 8th, 2010, 02:53 PM   #11
PLC
Member
United States

PLC is offline
 
Join Date: Sep 2002
Location: NC
Posts: 206
Thanks L D
Thats perfect!
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Devicenet Error Code 77 ganutenator LIVE PLC Questions And Answers 22 January 9th, 2014 08:43 AM
Problems transfering data from Protool to Simatic c7 635 OP NoName LIVE PLC Questions And Answers 7 December 20th, 2013 08:48 AM
MPI comunication Manuel Raposo LIVE PLC Questions And Answers 22 July 16th, 2007 07:24 AM
Building an S7 Array Move Questions DesertDog LIVE PLC Questions And Answers 19 June 17th, 2004 10:51 AM
Omron C200hx , Cpu64 pgeorge525 LIVE PLC Questions And Answers 6 October 9th, 2003 11:29 PM


All times are GMT -5. The time now is 05:34 AM.


.