Open an NC Variable; Go to project and select new; You will find a dialog box as shown
below; Select ncv_NcData.mdb
To read R parameters select the following option.
Double click on “rpa(.)” .You will find one more window .
Unit No: 1 (Channel Number)
Line: 200 (To read R201)
Save this file in some location with temp .var extension. Then go to code and select
option “Selections” to create a DB; Create a DB146 and mention the DB name e.g.
R_Values. Then click on code select options generate to create a source file. Save
[Link] file in some location.
Once again click on code select option “to STEP7 project”.
Step7 project window will get open; Select the concerned project. Click on “S7 Program”
And also select the option “transfer db and symbol”. Press OK
After executing that event a source file will get transferred to PLC project. This file will
get complied; the values of this source file will get transferred to DB146.
Open DB 146 and observe:
To Read Axis Position:
Open an NC Variable; Go to to project and select new; You will find a dialog box as
shown below; Select ncv_NcData.mdb
To read Axis Actual value of position, encoder 1. Select the below option.
Double click measPos1[.]. You will find the following window.
Line Number : Axis index number( 3rd axis in the machine).
Create a db147 as explained above; Save this NC var file in some location; Generate
source file as explained above; Transfer this source file to PLC project(As explained)
After this source file will get complied;
NOTE: There should not be any errors or warning message,
Open DB147 and check;
How to do it in PLC?
Also refer PLC sample [Link] go through FC60, DB146,DB147 and DB150
SIMATIC FC60 18/09/2007 7:08:12
Page 1 of 2
FC60 - <offline>
"POSN_FUN"
Name: NC_READ Family:
Author: BCS Version: 0.1
Block version: 2
Time stamp Code:
Interface:
18/09/2007 7:02:52
01/02/2005 5:09:04
Lengths (block/logic/data): 00400 00232 00006
Name Data Type Address Comment
IN 0.0
OUT 0.0
IN_OUT 0.0
TEMP 0.0
RETURN 0.0
RET_VAL 0.0
Block: FC60
Network: 1
ON/OFF Flag
AN "On_Off_flg"
= "On_Off_flg"
Network: 2
Request Flag Latch
A(
O "On_Off_flg"
O "GET1_req_flg"
)
AN "GET1_eror_flg"
AN "GET1_done_flg"
= "GET1_req_flg"
Network: 3
FB2 call "GET" variable data; DB149 is instant should be called whenever u are
calling a FB;
Req- Request bit has to be given;
Num Var- Corresponds to Number of variable to be read(Max 8 at a time)
Addr1:Read R variables in PLC;
RD1: Reads R variables are stored in some location;
Error : In ONLINE status this must show zero;
Addr1:P#db146.dbx0.0 byte 10
RD1:db150.dbd0
Eg. 1. Num Var:=2 // Max number of variable is 2
2. Addr1:= P#db146.dbx0.0 byte 10 // Take R201 variable into PLC
3. Addr2:= p#db147.dbx0.0 byte 10 // Take Z axis 1st meas sys value into PLC
4.RD1:=db150.dbd0 // Store R201 variable value in this memory location
5.RD2:=db150.dbd4 //Store Z axis position in This PLC location.
A "GET1_req_flg"
= L 0.0
BLD 103
CALL "GET" , DB149
Req :=L0.0
NumVar :=2 // Max number of variable is 2
Addr1 :="R_Vaules".C1_RP_rpa200_1 // Take R201 variable into PLC
SIMATIC FC60 18/09/2007 7:08:12
Page 2 of 2
Unit1 :=
Column1:=
Line1 :=
Addr2 :="Z_Position".C1_SEMA_measPos13_5 // Take Z axis 1st meas sys value into PLC
Unit2 :=
Column2:=
Line2 :=
Addr3 :=
Unit3 :=
Column3:=
Line3 :=
Addr4 :=
Unit4 :=
Column4:=
Line4 :=
Addr5 :=
Unit5 :=
Column5:=
Line5 :=
Addr6 :=
Unit6 :=
Column6:=
Line6 :=
Addr7 :=
Unit7 :=
Column7:=
Line7 :=
Addr8 :=
Unit8 :=
Column8:=
Line8 :=
Error :="GET1_eror_flg"
NDR :="GET1_done_flg"
State :=MW68
RD1 :="Read _R _PLC".R_201 // Store R201 variable value in this memory location
RD2 :="Read _R _PLC".Z_POS // Store Z axis position in This PLC location.
RD3 :=
RD4 :=
RD5 :=
RD6 :=
RD7 :=
RD8 :=
NOP 0