0% found this document useful (0 votes)
80 views9 pages

FC96

This document summarizes the code for an FC96 function block that handles communication between a SIMATIC PLC and a NS500 CNC system. The function block initializes variables, combines commands from the PLC and CNC, writes commands to the CNC, reads responses from the CNC, and transfers responses to the CNC over 16 networks. It uses SFC function blocks, data handling instructions, and bit logic operations to facilitate the transfer of commands and responses between the two systems.

Uploaded by

Hoangvinh Duong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views9 pages

FC96

This document summarizes the code for an FC96 function block that handles communication between a SIMATIC PLC and a NS500 CNC system. The function block initializes variables, combines commands from the PLC and CNC, writes commands to the CNC, reads responses from the CNC, and transfers responses to the CNC over 16 networks. It uses SFC function blocks, data handling instructions, and bit logic operations to facilitate the transfer of commands and responses between the two systems.

Uploaded by

Hoangvinh Duong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SIMATIC N3883001\SIMATIC 300(1)\PLC315-2DP M/S 2AF03\...

\FC96 - <offline> 10/28/2004 13:00:35

FC96 - <offline>
""
Name: Family:
Author: Version: 0.1
Block version: 2
Time stamp Code: 03/10/28 21:00:36Χ΋
Interface: 03/07/08 16:57:25Χ΋
Lengths (block/logic/data): 01330 01120 00048

Address Declaration Name Type Initial value Comment


0.0 in TransREQ BOOL Command Force Request
0.1 in ErrCLR BOOL Clear Request Signal of Error Bit
0.2 in CmdCLR BOOL Command Clear Request
2.0 in DBNo INT NS500 Command/Response DB Number
4.0 in DBNoPLC INT NS500 Command/Response DB Number for Manual Mode
6.0 in DPMCadrs INT $A_DBB[] (Command from NCK) Start Address
8.0 in DPMCadrss INT $A_DBB[] (Command from NCK) Semaphore Address
10.0 in DPMRadrs INT $A_DBB[] (Response to NCK) Start Address
12.0 in DPMRadrss INT $A_DBB[] (Response to NCK) Semaphore Address
14.0 out Error BOOL Error Status when writing/reading NS500 Command/Response Messages
16.0 out StateWR INT Error Status when writing NS500 Axis1 Command
18.0 out StateRD INT Error Status when reading NS500 Axis1 Response
in_out
0.0 temp FC21Err1 BOOL
0.1 temp FC21Err2 BOOL
0.2 temp AlwaysOn BOOL
2.0 temp FC21Code1 INT
4.0 temp FC21Code2 INT
6.0 temp Null ARRAY[0..1]
*4.0 temp DWORD
14.0 temp NullByte BYTE
15.0 temp SemByte BYTE
16.0 temp Stack1 BYTE
17.0 temp Stack2 BYTE
18.0 temp DataBuf ARRAY[0..1]
*4.0 temp DWORD
26.0 temp DBNum INT
28.0 temp DINum INT

Block: FC96 NS500 Command/Response Interface for NCK-Controlled Mode


Rev. 2003-9-11 : YSNC

Page 1..
SIMATIC N3883001\SIMATIC 300(1)\PLC315-2DP M/S 2AF03\...\FC96 - <offline> 10/28/2004 13:00:35

Network: 1 Initializing
Define DB as DBNo (NCK DB)
Define DI as DBNoPLC (PLC DB)

A #ErrCLR
R #Error
O #AlwaysOn
ON #AlwaysOn
= #AlwaysOn
L #DBNo
T #DBNum
OPN DB [#DBNum]
L #DBNoPLC
T #DINum
OPN DI [#DINum]

Network: 2 This function is not called under PLC Controlled mode


DIX16.0: NCK_EN signal (PLC DB)

DIX16.0
RET

Network: 3 Initializing

L L#0
T #NullByte
T #DataBuf[0]
T #DataBuf[1]
T #Null[0] //Command area: zero clear
L DBD 4
T #Null[1] //Data area: keep current value

Page 2..
SIMATIC N3883001\SIMATIC 300(1)\PLC315-2DP M/S 2AF03\...\FC96 - <offline> 10/28/2004 13:00:35

Network: 4 Command Clear

#CmdCLR FC21
EN ENO

#AlwaysOn Enable Error #FC21Err1

B#16#4 Funct ErrCode #FC21Code1

#NullByte S7Var
#DPMCadrss IVAR1
-1 IVAR2

FC21
EN ENO

#AlwaysOn Enable Error #FC21Err2

B#16#4 Funct ErrCode #FC21Code2

#Null S7Var

#DPMCadrs IVAR1
#DPMCadrss IVAR2

Symbol information
FC21 Transfer Quick Datachannel

Page 3..
SIMATIC N3883001\SIMATIC 300(1)\PLC315-2DP M/S 2AF03\...\FC96 - <offline> 10/28/2004 13:00:35

Network: 5 Command Recieve from NCK (1/4)

FC21
EN ENO

#AlwaysOn Enable Error #FC21Err1

B#16#3 Funct ErrCode #FC21Code1

#SemByte S7Var
#DPMCadrss IVAR1
-1 IVAR2

Symbol information
FC21 Transfer Quick Datachannel

Network: 6 Command Recieve from NCK (2/4)

CMP <>I COMB


JMP

#SemByte IN1
1 IN2

Page 4..
SIMATIC N3883001\SIMATIC 300(1)\PLC315-2DP M/S 2AF03\...\FC96 - <offline> 10/28/2004 13:00:35

Network: 7 Command Recieve from NCK (3/4)

FC21
EN ENO

#AlwaysOn Enable Error #FC21Err1

B#16#3 Funct ErrCode #FC21Code1

#DataBuf S7Var
#DPMCadrs IVAR1
#DPMCadrss IVAR2

Symbol information
FC21 Transfer Quick Datachannel

Network: 8 Command Recieve from NCK (4/4)

L #DataBuf[0]
T DBD 0
L #DataBuf[1]
T DBD 4

Network: 9 Command Combination

General Command (Byte0 Bit6~1) is always used from PLC-Controlled Data.


COMB: L DIB 0 // Basic Signals controlled by PLC
L B#16#7E // Bit 6~1
AW // AND
T #Stack1 // ==> Stack1

L DBB 0 // Mode&C_STRT Signals controlled by NCK


L B#16#A1 // Bit7,5,0
AW // AND
T #Stack2 // ==> Stack2

Page 5..
SIMATIC N3883001\SIMATIC 300(1)\PLC315-2DP M/S 2AF03\...\FC96 - <offline> 10/28/2004 13:00:35

L #Stack1
OW
T DBB 0 // Stack1 or Stack2 ==> DBB0

Network: 10 No requirement to communicate btw NCK & NS500

#TransREQ DIX16.1 DBX0.0 DBX0.2 DBX0.3 DBX0.5 DBX0.6


RET

Network: 11 Command Write to NS500

A DBX 0.0
= DIX 16.1

L DBD 0
T #DataBuf[0]
L DBD 4
CAD
T #DataBuf[1]
CALL SFC 15 "DPWR_DAT" -- Write Consistent Data to a Standard DP Slave
LADDR :=DIW18
RECORD :=#DataBuf
RET_VAL:=#StateWR

L 0
L #StateWR
==I
JC WROK

SET
S #Error

WROK: L DBB 0
L B#16#DF
AW
T DBB 0

Page 6..
SIMATIC N3883001\SIMATIC 300(1)\PLC315-2DP M/S 2AF03\...\FC96 - <offline> 10/28/2004 13:00:35

Network: 12 Response Read from NS500

CALL SFC 14 "DPRD_DAT" -- Read Consistent Data of a Standard DP Slave


LADDR :=DIW20
RET_VAL:=#StateRD
RECORD :=#DataBuf
L 0
L #StateRD
==I
JC RDOK

SET
S #Error

RDOK: L #DataBuf[0]
T DID 8
L #DataBuf[1]
T DID 12
CAD
T #DataBuf[1]

Network: 13 Response Transfer to NCK (1/3)

FC21
EN ENO

#AlwaysOn Enable Error #FC21Err1

B#16#3 Funct ErrCode #FC21Code1

#SemByte S7Var
#DPMRadrss IVAR1

-1 IVAR2

Symbol information
FC21 Transfer Quick Datachannel

Page 7..
SIMATIC N3883001\SIMATIC 300(1)\PLC315-2DP M/S 2AF03\...\FC96 - <offline> 10/28/2004 13:00:35

Network: 14 Response Transfer to NCK (2/3)

CMP <>I NOWR


JMP

#SemByte IN1
0 IN2

Network: 15 Response Transfer to NCK (3/3)

FC21
EN ENO

#AlwaysOn Enable Error #FC21Err1

B#16#4 Funct ErrCode #FC21Code1

#DataBuf S7Var
#DPMRadrs IVAR1
#DPMRadrss IVAR2

Symbol information
FC21 Transfer Quick Datachannel

Page 8..
SIMATIC N3883001\SIMATIC 300(1)\PLC315-2DP M/S 2AF03\...\FC96 - <offline> 10/28/2004 13:00:35

Network: 16

NOWR: NOP 0

Page 9

You might also like