|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.langner.jmatic2.FetchWrite
This class is used for communication with SIMATIC S7® PLCs utilizing the FETCH/WRITE protocol over a TCP or a ISO-On-TCP connection. The plc has to be configured for a FetchWrite communication. It is important to have two communications configured, one for Fetch and one for Write. The Siemens S5 or S7 is not able to handle Fetch and Write on one connection.
| Constructor Summary | |
FetchWrite(FetchWriteRFC1006Settings settings)
Constructs an initialized object for a ISO-On-TCP connection. |
|
FetchWrite(FetchWriteTCPSettings settings)
Constructs an initialized object for a TCP connection. |
|
| Method Summary | |
void |
connect()
Establishes a connection to the S7 PLC. |
void |
disconnect()
Disconnects from the S7 PLC. |
ErrorInfo |
getLastError()
Returns the last error. |
boolean |
isConnected()
Returns the connection status of the FetchWrite object. |
boolean |
isConnectedFetch()
Returns the connection status of the FetchWrite object. |
boolean |
isConnectedWrite()
Returns the connection status of the FetchWrite object. |
int |
readCounter(int address,
byte[] data)
Requests data of one PLC counter cell (synchronous). |
int |
readDB(int dbnumber,
int offset,
int length,
byte[] data)
Requests data from a specific PLC data block (synchronous). |
int |
readInput(int address,
int length,
byte[] data)
Requests input data from a specific PLC address (synchronous). |
int |
readMemoryBytes(int address,
int length,
byte[] data)
Requests PLC flag data (synchronous). |
int |
readOutput(int address,
int length,
byte[] data)
Requests output data from a specific PLC address (synchronous). |
int |
readTimer(int address,
byte[] data)
Requests the data of one PLC timer cell (synchronous). |
int |
writeDB(int dbnumber,
int offset,
int length,
byte[] data)
Transmits data to a specific PLC data block (DB). |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FetchWrite(FetchWriteTCPSettings settings)
throws JMaticException
settings - Object with the connection settings
JMaticException
public FetchWrite(FetchWriteRFC1006Settings settings)
throws JMaticException
settings - Object with the connection settings
JMaticException| Method Detail |
public boolean isConnected()
isConnected in interface IConnectionconnect,
disconnectpublic boolean isConnectedFetch()
connect,
disconnectpublic boolean isConnectedWrite()
connect,
disconnect
public void connect()
throws JMaticException
FetchWriteTCPSettings object.
This function will pause until exception is thrown. If it returns normally, the connection
has been established successfully.
connect in interface IConnectionJMaticException - if the connect attempt failsisConnectedFetch,
isConnectedWrite,
disconnect
public void disconnect()
throws JMaticException
disconnect in interface IConnectionJMaticException - if the disconnect failsisConnectedFetch,
isConnectedWrite,
connectpublic ErrorInfo getLastError()
getLastError in interface IS7
public int writeDB(int dbnumber,
int offset,
int length,
byte[] data)
throws JMaticException
writeDB in interface IS7dbnumber - Target data block. Possible range: 1..255.offset - Target memory address in byte. Allowed values are 0..4094.length - The number of bytes of the array data that are to be sent. Allowed values are 2..4096.data - Array of transmit data
JMaticException - if the FetchWrite object is not connected or the parameters are out of range
public int readDB(int dbnumber,
int offset,
int length,
byte[] data)
throws JMaticException
readDB in interface IS7dbnumber - Target data block. Possible values are 1..255.offset - Target memory byte address. Allowed values are 0..4094.data - Array for the requested data.length - The number of requested bytes. Possible values: 2..4096.
NOTE: The length parameter must be an even number, because data blocks (DB) are working with word length.
JMaticException - if the object is not connected or the parameters are out of range
public int readInput(int address,
int length,
byte[] data)
throws JMaticException
readInput in interface IS7address - Target address.data - Array for the requested data.length - The number of requested bytes.
JMaticException - if the object is not connected or the parameters are out of range
public int readMemoryBytes(int address,
int length,
byte[] data)
throws JMaticException
readMemoryBytes in interface IS7address - Target address.data - Array for the requested data.length - The number of requested bytes.
JMaticException - if the object is not connected or the parameters are out of range
public int readOutput(int address,
int length,
byte[] data)
throws JMaticException
readOutput in interface IS7address - Target address.data - Array for the requested data.length - The number of requested bytes.
JMaticException - if the object is not connected or the parameters are out of range
public int readTimer(int address,
byte[] data)
throws JMaticException
readTimer in interface IS7address - Timer address.data - Array for the requested data.
JMaticException - if the object is not connected or the parameters are out of range
public int readCounter(int address,
byte[] data)
throws JMaticException
readCounter in interface IS7address - Counter address.data - Array for the requested data.
JMaticException - if the object is not connected or the parameters are out of range
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||