Allen Bradley Driver
BIG FAT WARNING:
This is pre-alpha code and information.
You assume all responsibility for its use.
DANGER: DON'T connect to a PLC unless you are certain it is safe to do so!!!
It is assumed that you are experienced in PLC programming/troubleshooting
and that you know EXACTLY what you are doing. PLC's are used to control
industrial processes, motors, steam valves, hydraulic presses, etc.
You are ABSOLUTELY RESPONSIBLE for ensuring that NO-ONE is in danger
of being injured or killed because you affected the operation
of a running PLC.
Also expect that buggy drivers could write data even when you expect that
they will read only !!!
I've tested this driver with Allen Bradley's SLC 50/3. It uses DF1 protocol
on channel 0 (RS232). In the test case channel 0 was set to use DF1 full duplex
protocol with 9600 baud, no parity and one stop bit and CRC error checking.
It was a point to point connection, so no I did not implement source/dest
address fields but set them simply to 0.
Details of Allen Breadley protocol can be found in
Allen Bradley DH485+ Manual.
The driver can currently only read integer or floating point values from
the PLC's files using what AB calls the
"protected typed read with three address fields"
command (CMD=0xF, FNC=0xA2).
The ability to read other data types could easily be added. I cannot test write
commands currently, because the only such PLC available for me is in a
Fields marked with an asterisk (*) are Allen Bradley's command and type
codes. They will be directly copied into the respective fields of messages.
Be extremely careful with them as AB warns us that undefined codes may
give unpredictable results !!
|Opening object tag||Object properties|
||Data type code*
||Closing object tag
||'This will copy 20 bytes (10 integers) from file N7 beginning with element 100 as integers to D1..D10 if A1 is<>0. It will put execution error code into E1'
||'if A1 is<>0, this will copy 20 bytes (5 float numbers)
from file F8 beginning with
element 60 to to F1..F5 as floating point numbers.
It will put execution error code into E2'
|Comment||Anything you want||Use it to remeber the purpose of the line|
|CMD||15||AB's command code 0xF.|
|FNC||162||AB's command code 0xA2.|
|File No.||depends on files in PLC||The file to read from|
|Data type code||137,138
||AB's data type code. The driver uses this to convert byte sequence to double.
You cannot siply put in other type codes here without extending the driver.|
|Start address||first to last element in PLC file
||Start address in PLC|
|Byte count||1..82||Number of bytes to transmit|
|Sheet||1..last sheet used||Number of spreadsheet to store data|
|Start Coord.||A1..NTP10000||First cell cooresponding to first address. Next data elements go to or are taken from cosecutive rows.|
|Condition||A1..NTP10000||A cell which must have numerical contents non zero in order to execute the transfer.|
|Error Coord.||A1..NTP10000||This cell takes an error code or zero if transmission went o.k.|
All PLC drivers use blocks of data. The first and last element in PLC memory
are used to specify a block. For the corresponding area in the spreadsheet,
the first cell coordinate is specified. Further data elements are copied to
or taken from consecutive row of the same column.
The driver transfers a block of data for each instruction.
If you use for example elements 1 to 5 of some file and elements 8 to 10 of the
it is faster to read elements 1 to 10 as one block and just do nothing with
elements 6 and 7.