DF1 Toman Tron
DF1 Toman Tron
Free DF1 Driver for Allen Bradley SLC500 and Micrologix Programmable Logic
Controllers.
Key Features:
PLC types supported: SLC 5/03, 5/04, 5/05 and Micrologix1000 channel 0 configured for full duplex
DF1, no handshaking. Operation with these PLC’s was fully tested.
Communication commands used: Protected typed logical read with three address fields, CMD 0F
and FNC A2
Protected typed logical write with three address fields, CMD 0F
and FNC AA
OnDataAvailable event
DF1TomanTron Members:
Properties:
[VB.NET]
Public Property CheckSum() As TomantronDF1Lib.DF1TomanTron.SumCheckEnumerator
Either CRC or BCC.
[VB.NET]
Public Property ReadElementNo() As Byte
Starting Element number of PLC Integer (N) data to be read each time the ReadPollTime timer
expires.
[VB.NET]
Public Property ReadFileNo() As Byte
File number of PLC Integer (N) data to be read each time the ReadPollTime timer expires.
[VB.NET]
Public Property ReadNoOfElements() As Integer
Number of elements of PLC Integer (N) data to be read each time the ReadPollTime timer expires.
Maximum value is 100.
DF1TomanTron1.ReadFileNo = 7
DF1TomanTron1.ReadElementNo = 0
DF1TomanTron1.ReadNoOfElements = 50
[VB.NET]
Public Property ReadPollTime() As Integer
Polling rate in ms at which the integer data will be read from the PLC.
Range 100 ms to 32767 ms.
User needs to set the appropriate polling rate for reliable operation.
Consider the Baud rate and number of characters to determine the optimal polling rate.
For example, if you were going to read 100 integers at 9600 Baud, you would need 1 ms per character
and there would be appr. 220 characters in a message (2 characters per integer plus
overhead). You should use 250 ms polling rate. Setting the polling rate faster than 220 ms
will result in missed write requests. In applications where no data will be written into the PLC
you can set the polling rate to 100ms.
[VB.NET]
Public ReadOnly Property ReadIntegerData() As Integer()
Range: ReadIntegerData(0) to ReadIntegerData(99).
Integer data read from the PLC each time the ReadPollTime timer expires.
'VB.NET example, read 10 Integers to text boxes when OnDataAvailable
'event is triggered.
[VB.NET]
Public Property WriteFileNo() As Byte
File number of the Integer (N) data to be written to PLC each time the WriteToPLC
Method is called.
[VB.NET]
Public Property WriteElementNo() As Byte
Starting Element number of Integer (N) data to be written to PLC each time the
WriteToPLC method is called.
DF1TomanTron Methods:
[VB.NET]
Sub WriteToPLC(ByVal ParamArray IntegerData() As Integer)
Range: IntegerData(0) to IntegerData(99).
When this method is called the IntegerData() will be written to PLC file number specified
in WriteFileNo() Property and element number in WriteElementNo() Property.
Length of the data is automatically determined by ParamArray Keyword which allows you
to pass in a variable number of parameters.
Data(0) = 1
Data(1) = 2
Data(2) = 3
DataThree = 4
DF1TomanTron1.WriteFileNo = 8
DF1TomanTron1.WriteElementNo = 1
DF1TomanTron1.WriteToPLC(Data)
DF1TomanTron1.WriteFileNo = 8
DF1TomanTron1.WriteElementNo = 4
DF1TomanTron1.WriteToPLC(DataThree, 5, 6)
[VB.NET]
Public Function OpenComPort (ByVal ComPort As String, ByVal BaudRate As Integer, ByVal
theParity As String, ByVal DataBits As Integer, ByVal StopBits As Integer) As Boolean
Parameters:
ComPort
Number of the Com Port to be opened.
Allowable ComPorts are: “COM1” “COM2” “COM3” “COM4” “COM5” “COM6” “COM7”
“COM8”
BaudRate
Baud Rate.
Allowable baud rates are: 9600, 19200, 38400
theParity
Parity.
Allowable parities are: “N” “O” “E” (None, Odd, Even)
DataBits
Number of data bits.
Allowable data bits are: 7 and 8
StopBits
Number of stop bits.
Allowable stop bits are: 1 and 2
Return Type:
[VB.NET]
Public Sub CloseComPort()
Closes the ComPort if it is opened.