Class TNoDave
TObject <-- ... <-- TComponent <-- TNoDave
Declared in Unit NoDaveComponent
No known Subclasses
Used by Classes:
TNoDaveConnectThread, TNoDaveReadThread
The Class TNoDave encapsulates the access to the libnodave.dll of Thomas Hergenhahn.
All the settings for the communication are available in the properties of TNoDave.
- Used in
- Register, TNoDaveConnectThread, TNoDaveReadThread
List of Constructors:
constructor Create
- Initialize a new instance of the TNoDave component.
List of Destructors:
destructor Destroy
- Close an active connection and call the inherited Destroy method.
List of Methods:
function AreaCode
- Determine the S7-ID of an Area.
function BufferAt
- Return a Pointer to the requested PLC-data point within the buffer.
procedure Connect
- Open the connection to the PLC.
procedure Disconnect
- Close the connection to the PLC.
procedure DoConnect
- Open the connection to the PLC specified by the properties Protocol, CPURack, CPUSlot,
COMPort, IPAddress, IPPort, MPILocal, MPIRemote
and/or MPISpeed
procedure DoOnConnect
- Create the worker-thread for cyclic reading if neccessary and call the OnConnect-eventhandler if specified.
procedure DoOnDisconnect
- Stop and Destroy the worker-thread for cyclic reading if neccessary and call the OnDisconnect-eventhandler if specified.
procedure DoOnError
- Call the OnError-eventhandler if specified.
procedure DoOnRead
- Call the OnRead-eventhandler if specified.
procedure DoOnWrite
- Call the OnWrite-eventhandler if specified.
procedure DoReadBytes
- Read the PLC-data into the buffer.
procedure DoSetDebug
- Set the debug-options of the libnodave.dll
procedure DoWriteBytes
- Write the Buffer-data into the PLC.
procedure DoWriteValue
- Write a single value into the specified address of the PLC without changing the properties of the TNoDave-instance.
function GetBit
- Return the Bit-value read last from the PLC at the specified address.
function GetByte
- Return the Byte-value read last from the PLC at the specified address.
function GetDInt
- Return the LongInt-value read last from the PLC at the specified address.
function GetDWord
- Return the LongWord-value read last from the PLC at the specified address.
function GetErrorMsg
- Return the text message for an error code.
function GetFloat
- Return the Float-value read last from the PLC at the specified address.
function GetInt
- Return the SmallInt-value read last from the PLC at the specified address.
function GetWord
- Return the Word-value read last from the PLC at the specified address.
function ListReachablePartners
- Scan the MPI-bus for all reachable partners
procedure Loaded
- Open the connection to the PLC after the instance is completely loaded from the stream and if Active is True.
procedure Lock
- Lock the communication-routines for the current tread.
function ProtCode
- Determine the libnodave.dll-code of a protocol
procedure ReadBytes
- Read the specified Data from the PLC into the buffer.
procedure ReadBytes
- Read the Data specified by the properties Area, DBNumber, BufOffs
and BufLen from the PLC into the buffer.
function ReadSZL
- Read a SZL-list from the connected PLC.
procedure ResetInterface
- Reset the NetLink-adapter via network-command
function Swap16
- Swap the byte-order in a 16-bit value.
function Swap32
- Swap the byte-order in a 32-bit value.
procedure Unlock
- Unlock the communication-routines for other threads.
procedure WriteBit
- Write a Bit-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
procedure WriteBit
- Write a Bit-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
procedure WriteByte
- Write a Byte-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
procedure WriteBytes
- Write the buffer into the PLC at the address specified by the properties Area, DBNumber,
BufOffs and BufLen.
procedure WriteBytes
- Write the buffer into the PLC at the specified address after setting up the properties with the given values.
procedure WriteDInt
- Write a LongInt-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
procedure WriteDWord
- Write a LongWord-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
procedure WriteFloat
- Write a Float-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
procedure WriteInt
- Write a SmallInt-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
procedure WriteWord
- Write a Word-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
Properties:
property Active: Boolean read GetActive write SetActive- Property for the connection-status.
- Used in
- Connect, Disconnect, DoConnect, ListReachablePartners, ReadBytes, ReadSZL, ResetInterface, WriteBytes, TNoDaveConnectThread.Execute, TNoDaveReadThread.Execute
property Area: TNoDaveArea read FArea write SetArea- Property for the PLC-area
- Used in
- TNoDaveReadThread.Execute
property Buffer: String read GetBuffer- Property for the pointer to the internal buffer memory.
property BufLen: Integer read FBufLen write SetBufLen- Property for the length of the buffer.
- Used in
- TNoDaveReadThread.Execute
property BufOffs: Integer read FBufOffs write SetBufOffs- Property for the offset of the buffer within the address-range of the PLC.
- Used in
- TNoDaveReadThread.Execute
property COMPort: String read FComPort write SetComPort- Property for the name of the COM-Port used for the serial-to-MPI adapter.
property COMSpeed: TNoDaveComSpeed read FComSpeed write SetComSpeed- Property for the speed of the COM-Port used for the serial-to-MPI adapter.
- Used in
- DoConnect
property CPURack: Integer read FCpuRack write SetCpuRack- Property for the number of the rack containing the CPU of the PLC.
property CPUSlot: Integer read FCpuSlot write SetCpuSlot- Property for the number of the slot containing the CPU of the PLC.
property CycleTime: Cardinal read FCycleTime- Property for the duration in ms of the last communication cycle.
property DBNumber: Integer read FDBNumber write SetDBNumber- Property for the number of the datablock in the PLC.
- Used in
- TNoDaveReadThread.Execute
property DebugOptions: TNoDaveDebugOptions read GetDebugOptions write SetDebugOptions- Property for the debug-options.
property Interval: Cardinal read FInterval write SetInterval- Property for the minimal round-trip cycle time for the background-communication with the PLC in milliseconds.
- Used in
- TNoDaveReadThread.Execute
property IntfName: String read FIntfName write SetIntfName- Property for the symbolic name of the interface.
property IntfTimeout: Integer read FIntfTimeout write SetIntfTimeout- Property for the timeout of the interface in milliseconds.
property IPAddress: String read FIPAddress write SetIPAddress- Property for the IP-address or name of the TCP/IP partner station.
property IPPort: Integer read FIPPort write SetIPPort- Property for the IP-port of the TCP/IP partner station.
property LastErrMsg: String read GetLastErrMsg- Property for the text describing the code in LastError.
- Used in
- TNoDaveReadThread.Execute
property LastError: Integer read FLastError- Property for the return-code of the last call of a communication-method.
- Used in
- TNoDaveReadThread.Execute
property MaxPDUData: Integer read GetMaxPDUData- Property for the maximum datasize of one read-request
- Used in
- DoReadBytes, DoWriteBytes
property MPILocal: Integer read FMPILocal write SetMPILocal- Property for the local MPI-address used for the MPI-communication.
property MPIRemote: Integer read FMPIRemote write SetMPIRemote- Property for the remote MPI-address used for the MPI-communication.
property MPISpeed: TNoDaveSpeed read FMPISpeed write SetMPISpeed- Property for the MPI-speed used for the MPI-communication.
property OnConnect: TNotifyEvent read FOnConnect write FOnConnect- Property for the OnConnect-eventhandler
- Used in
- DoOnConnect
property OnDisconnect: TNotifyEvent read FOnDisconnect write FOnDisconnect- Property for the OnDisconnect-eventhandler
- Used in
- DoOnDisconnect
property OnError: TNoDaveOnErrorEvent read FOnError write FOnError- Property for the OnError-eventhandler
- Used in
- DoOnError
property OnRead: TNotifyEvent read FOnRead write FOnRead- Property for the OnRead-eventhandler
- Used in
- DoOnRead
property OnWrite: TNotifyEvent read FOnWrite write FOnWrite- Property for the OnWrite-eventhandler
- Used in
- DoOnWrite
property Protocol: TNoDaveProtocol read FProtocol write SetProtocol- Property for the Protocol used for the communication with the PLC.
- Used in
- ResetInterface
property SZLCount: Integer read GetSZLCount- Property for the number of items in the internal SZL-Buffer
property SZLItem [Index: Integer]: Pointer read GetSZLItem- Property for the items in the internal SZL-Buffer
property SZLItemSize: Integer read GetSZLItemSize- Property for the size of one item in the internal SZL-Buffer
Constructors:
constructor Create(aOwner: TComponent); override- Initialize a new instance of the TNoDave component.
- Parameters
- aOwner
- Owner of the created instance.
- Overrides
- Create
Destructors:
destructor Destroy; override- Close an active connection and call the inherited Destroy method.
- Overrides
- Destroy
Methods:
function AreaCode(Area: TNoDaveArea): Integer- Determine the S7-ID of an Area.
- Parameters
- Area
- Requested Area.
- Result
- S7-ID of the Area.
- Called by
- DoReadBytes, DoWriteBytes, DoWriteValue, WriteBit
function BufferAt(Address: Integer; Size: Integer = 1; Buffer: Pointer = Nil; BufOffs: Integer = 0; BufLen: Integer = 0): Pointer- Return a Pointer to the requested PLC-data point within the buffer.
- Parameters
- Address
- PLC-Address of the datapoint.
- Size
- Size of the datapoint in bytes.
- Buffer
- Pointer to the buffer holding the PLC-data. The internal buffer is used, if Nil (default).
- BufOffs
- Offset-address of the buffer within the address-range of the PLC.
- BufLen
- Length of the buffer in bytes.
- Result
- Pointer to the requested data point if the address is located in the buffer, else Nil.
- Called by
- GetBit, GetByte, GetDInt, GetDWord, GetFloat, GetInt, GetWord
procedure Connect(Wait: Boolean = True)- Open the connection to the PLC.
- Parameters
- Wait
- If False the connection is opened asyncronous in a separate thread. Default is True.
- Called by
- Loaded
procedure Disconnect- Close the connection to the PLC.
- Called by
- Destroy, TNoDaveReadThread.Execute
procedure DoConnect(OnlyIntf: Boolean = False)- Open the connection to the PLC specified by the properties Protocol, CPURack, CPUSlot,
COMPort, IPAddress, IPPort, MPILocal, MPIRemote
and/or MPISpeed
- Parameters
- OnlyIntf
- Open only the interface, don't connect to the PLC
- Called by
- Connect, ResetInterface, TNoDaveConnectThread.Execute
procedure DoOnConnect- Create the worker-thread for cyclic reading if neccessary and call the OnConnect-eventhandler if specified.
- Called by
- Connect, TNoDaveConnectThread.DoOnConnect
procedure DoOnDisconnect- Stop and Destroy the worker-thread for cyclic reading if neccessary and call the OnDisconnect-eventhandler if specified.
- Called by
- Disconnect
procedure DoOnError(ErrorMsg: String)- Call the OnError-eventhandler if specified.
- Parameters
- ErrorMsg
- The text-message for the OnError-event
- Called by
- BufferAt, Connect, Disconnect, DoConnect, DoReadBytes, DoWriteBytes, DoWriteValue, WriteBit, TNoDaveConnectThread.DoOnError, TNoDaveReadThread.DoOnError
procedure DoOnRead- Call the OnRead-eventhandler if specified.
- Called by
- ReadBytes, TNoDaveReadThread.DoOnRead
procedure DoOnWrite- Call the OnWrite-eventhandler if specified.
- Called by
- WriteBytes
procedure DoReadBytes(Area: TNoDaveArea; DB, Start, Size: Integer; Buffer: Pointer = Nil)- Read the PLC-data into the buffer.
- Parameters
- Area
- Requested PLC-area.
- DB
- Number of requested datablock. Only used, if reading from Datablocks in the PLC.
- Start
- Start-address of the requested data within the address-range of the PLC.
- Size
- Length of the requested PLC-data in bytes.
- Buffer
- Pointer to the buffer. The internal buffer of the instance is used, if Nil (default).
- Called by
- ReadBytes, ReadBytes, TNoDaveReadThread.Execute
procedure DoSetDebug(Options: Integer)- Set the debug-options of the libnodave.dll
- Parameters
- Options
- Value of the debug-options.
procedure DoWriteBytes(Area: TNoDaveArea; DB, Start, Size: Integer; Buffer: Pointer = Nil)- Write the Buffer-data into the PLC.
- Parameters
- Area
- Requested PLC-area.
- DB
- Number of requested datablock. Only used, if reading from Datablocks in the PLC.
- Start
- Start-address of the requested data within the address-range of the PLC.
- Size
- Length of the requested PLC-data in bytes.
- Buffer
- Pointer to the buffer. The internal buffer of the instance is used, if Nil (default).
- Called by
- WriteBytes, WriteBytes
procedure DoWriteValue(Address, Size: Integer; Value: Pointer)- Write a single value into the specified address of the PLC without changing the properties of the TNoDave-instance.
- Parameters
- Address
- PLC-Address of the data point.
- Size
- Size in bytes of the value.
- Value
- The value to be written.
- Called by
- WriteByte, WriteDInt, WriteDWord, WriteFloat, WriteInt, WriteWord
function GetBit(Address, Bit: Integer; Buffer: Pointer = Nil; BufOffs: Integer = 0; BufLen: Integer = 0): Boolean- Return the Bit-value read last from the PLC at the specified address.
- Parameters
- Address
- Byte-address of the requested value
- Bit
- Bit-address of the requested value
- Buffer
- Pointer to the buffer holding the PLC-data. The internal buffer is used, if Nil (default).
- BufOffs
- Offset-address of the buffer within the address-range of the PLC.
- BufLen
- Length of the buffer in bytes.
- Result
- The requested value or False, if the requested address was not found within the buffer.
function GetByte(Address: Integer; Buffer: Pointer = Nil; BufOffs: Integer = 0; BufLen: Integer = 0): Byte- Return the Byte-value read last from the PLC at the specified address.
- Parameters
- Address
- Address of the requested value
- Buffer
- Pointer to the buffer holding the PLC-data. The internal buffer is used, if Nil (default).
- BufOffs
- Offset-address of the buffer within the address-range of the PLC.
- BufLen
- Length of the buffer in bytes.
- Result
- The requested value or 0, if the requested address was not found within the buffer.
function GetDInt(Address: Integer; Buffer: Pointer = Nil; BufOffs: Integer = 0; BufLen: Integer = 0): LongInt- Return the LongInt-value read last from the PLC at the specified address.
- Parameters
- Address
- Address of the requested value
- Buffer
- Pointer to the buffer holding the PLC-data. The internal buffer is used, if Nil (default).
- BufOffs
- Offset-address of the buffer within the address-range of the PLC.
- BufLen
- Length of the buffer in bytes.
- Result
- The requested value or 0, if the requested address was not found within the buffer.
function GetDWord(Address: Integer; Buffer: Pointer = Nil; BufOffs: Integer = 0; BufLen: Integer = 0): LongWord- Return the LongWord-value read last from the PLC at the specified address.
- Parameters
- Address
- Address of the requested value
- Buffer
- Pointer to the buffer holding the PLC-data. The internal buffer is used, if Nil (default).
- BufOffs
- Offset-address of the buffer within the address-range of the PLC.
- BufLen
- Length of the buffer in bytes.
- Result
- The requested value or 0, if the requested address was not found within the buffer.
function GetErrorMsg(Error: Integer): String- Return the text message for an error code.
- Parameters
- Error
- The error code.
- Result
- Text message correspondig to the error code.
function GetFloat(Address: Integer; Buffer: Pointer = Nil; BufOffs: Integer = 0; BufLen: Integer = 0): Double- Return the Float-value read last from the PLC at the specified address.
- Parameters
- Address
- Address of the requested value
- Buffer
- Pointer to the buffer holding the PLC-data. The internal buffer is used, if Nil (default).
- BufOffs
- Offset-address of the buffer within the address-range of the PLC.
- BufLen
- Length of the buffer in bytes.
- Result
- The requested value or 0, if the requested address was not found within the buffer.
function GetInt(Address: Integer; Buffer: Pointer = Nil; BufOffs: Integer = 0; BufLen: Integer = 0): SmallInt- Return the SmallInt-value read last from the PLC at the specified address.
- Parameters
- Address
- Address of the requested value
- Buffer
- Pointer to the buffer holding the PLC-data. The internal buffer is used, if Nil (default).
- BufOffs
- Offset-address of the buffer within the address-range of the PLC.
- BufLen
- Length of the buffer in bytes.
- Result
- The requested value or 0, if the requested address was not found within the buffer.
function GetWord(Address: Integer; Buffer: Pointer = Nil; BufOffs: Integer = 0; BufLen: Integer = 0): Word- Return the Word-value read last from the PLC at the specified address.
- Parameters
- Address
- Address of the requested value
- Buffer
- Pointer to the buffer holding the PLC-data. The internal buffer is used, if Nil (default).
- BufOffs
- Offset-address of the buffer within the address-range of the PLC.
- BufLen
- Length of the buffer in bytes.
- Result
- The requested value or 0, if the requested address was not found within the buffer.
- Called by
- ReadSZL
function ListReachablePartners: TNoDaveReachablePartnersMPI- Scan the MPI-bus for all reachable partners
- Result
- List with True for available partners and False for unavailable partners.
procedure Loaded; override- Open the connection to the PLC after the instance is completely loaded from the stream and if Active is True.
- Overrides
- Loaded
procedure Lock- Lock the communication-routines for the current tread.
function ProtCode(Prot: TNoDaveProtocol): Integer- Determine the libnodave.dll-code of a protocol
- Parameters
- Prot
- The requested protocol
- Result
- The libnodave.dll code for the protocol
- Called by
- DoConnect
procedure ReadBytes(Area: TNoDaveArea; DB, Start, Size: Integer; Buffer: Pointer = Nil); overload- Read the specified Data from the PLC into the buffer.
- Parameters
- Area
- Requested PLC-area.
- DB
- Number of requested datablock. Only used, if reading from Datablocks in the PLC.
- Start
- Start-address of the requested data within the address-range of the PLC.
- Size
- Length of the requested PLC-data in bytes.
- Buffer
- Pointer to the buffer for PLC-data. The internal buffer is used, if Nil (default).
procedure ReadBytes(Buffer: Pointer = Nil); overload- Read the Data specified by the properties Area, DBNumber, BufOffs
and BufLen from the PLC into the buffer.
- Parameters
- Buffer
- Pointer to the buffer for PLC-data. The internal buffer is used, if Nil (default).
- Called by
- DoConnect, ReadBytes
function ReadSZL(ID, Index: Integer): Integer- Read a SZL-list from the connected PLC.
- Parameters
- ID
- The SZL-ID of the list.
- Index
- The SZL-Index of the list.
- Result
- Error code for the function result, 0 if OK.
procedure ResetInterface- Reset the NetLink-adapter via network-command
function Swap16(Value: SmallInt): SmallInt- Swap the byte-order in a 16-bit value.
- Parameters
- Value
- The value for the conversion.
- Result
- The converted value.
function Swap32(Value: Integer): Integer- Swap the byte-order in a 32-bit value.
- Parameters
- Value
- The value for the conversion.
- Result
- The converted value.
procedure Unlock- Unlock the communication-routines for other threads.
procedure WriteBit(Area: TNoDaveArea; DB, Address, Bit: Integer; Value: Boolean); overload- Write a Bit-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
- Parameters
- Area
- Requested PLC-area.
- DB
- Number of requested datablock. Only used, if writing into datablocks of the PLC.
- Address
- Byte-address of the value
- Bit
- Bit-address of the value
- Value
- Value to write into the PLC.
- Called by
- WriteBit
procedure WriteBit(Address, Bit: Integer; Value: Boolean); overload- Write a Bit-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
- Parameters
- Address
- Byte-address of the value
- Bit
- Bit-address of the value
- Value
- Value to write into the PLC.
procedure WriteByte(Address: Integer; Value: Byte)- Write a Byte-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
- Parameters
- Address
- Byte-address of the value
- Value
- Value to write into the PLC.
procedure WriteBytes(Buffer: Pointer = Nil); overload- Write the buffer into the PLC at the address specified by the properties Area, DBNumber,
BufOffs and BufLen.
- Parameters
- Buffer
- Pointer to the buffer for PLC-data. The internal buffer is used, if Nil (default).
- Called by
- WriteBytes
procedure WriteBytes(Area: TNoDaveArea; DB, Start, Size: Integer; Buffer: Pointer = Nil); overload- Write the buffer into the PLC at the specified address after setting up the properties with the given values.
- Parameters
- Area
- Requested PLC-area. Changes the property Area.
- DB
- Number of requested datablock. Changes the property DBNumber. Only used, if writing into datablocks of the PLC.
- Start
- Start-address of the buffer within the address-range of the PLC. Changes the property BufOffs.
- Size
- Length of the buffer in bytes. Changes the property BufLen.
- Buffer
- Pointer to the buffer for PLC-data. The internal buffer is used, if Nil (default).
procedure WriteDInt(Address: Integer; Value: LongInt)- Write a LongInt-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
- Parameters
- Address
- Byte-address of the value
- Value
- Value to write into the PLC.
procedure WriteDWord(Address: Integer; Value: LongWord)- Write a LongWord-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
- Parameters
- Address
- Byte-address of the value
- Value
- Value to write into the PLC.
procedure WriteFloat(Address: Integer; Value: Single)- Write a Float-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
- Parameters
- Address
- Byte-address of the value
- Value
- Value to write into the PLC.
procedure WriteInt(Address: Integer; Value: SmallInt)- Write a SmallInt-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
- Parameters
- Address
- Byte-address of the value
- Value
- Value to write into the PLC.
procedure WriteWord(Address: Integer; Value: Word)- Write a Word-value into the PLC at the specified address without changing the properties of the TNoDave-instance.
- Parameters
- Address
- Byte-address of the value
- Value
- Value to write into the PLC.