SourceForge Logo

GE Fanuc SNPX 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 !!!

This driver talks GE Fanuc's SNPX protocol. The protocol is described in a document gfk0582d.pdf which is can be found on GE's web site.
Somebody may check if the driver fully conforms to this, because I did it without knowing that document. I just watched communication between PLC and programmer software.
Because the programmer interface of the PLC uses RS485, you need a converter. Converters are widely available from several manufacturers.
The SNPX protocol supports multiple PLCs connected to the same bus. In order to use this, each PLC must be assigned an indivdual SNP-ID. This can be done with GE's programming/configuration software. A PLC responds to a message either when the SNP-ID field is identical to it's own SNP-ID or left blank.So, if you leave it blank, all PLCs will respond.
This is supported by the driver in the following manner:
The driver assumes that you have a spreadsheet for each PLC. The driver accepts a first and last sheet number. You specify a cell coordinate containing the SNP-ID. This must be a text cell. The driver then executes the transfer instruction for each sheet in the given range taking the (hopefully different) SNP-IDs from this cell. The driver can read and write the following data types:

Hint:

Be carefull when writing single bits! The underlying protocol writes a whole byte at a time. To achieve bit writing, the byte is fetched first, then the bit is set or reset and the byte is written back. Because the data exchage is in no way synchronized with the PLC's execution cycle, the PLC might have se reset other bits in the same byte in the meantime. Writing back the byte will undo these changes, producig strange effects. In other words: Bit writing is ok long as your PLC program uses all bits in this byte READ ONLY.

opening object tagobject properties
object typeComment First sheet Last sheet First address Last address Direction DB number First cell Condition SNP ID cell Closing object tag
<ALSPA> 'This reads MW0..MW10 to D3.. if C3 is<>0' 3 0 10 0 -1 'D3' 'B1' </ALSPA>
<ALSPA> 'This writes from C3.. to MW0..MW10 to D3 if B1 is<>0' 3 0 10 1 -1 'C3' 'B1' </ALSPA>
ParameterPossible valuesMeaning
CommentAnything you wantUse it to remeber the purpose of the line
First sheet1..last sheetFirst spreadsheet used
Last sheet1..last sheetLast spreadsheet used
First addressPLC address rangeStart address in PLC
Last addressPLC address rangeEnd address in PLC
Direction0 or 10 means read,1 means write
Data type0..3
0Bits from outputs memory image
1Words from inputs memory image
2Bytes from inputs memory image
3Bits from inputs memory image
First cellA1..NTP10000First cell cooresponding to first address. Next data elements go to or are taken from cosecutive rows.
ConditionA1..NTP10000A cell which must have numerical contents non zero in order to execute the transfer.
SNP IDA1..NTP10000A cell which contains the SNP ID of the PLC.

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.

Speed hint:

The driver transfers data for each instruction. If you use for example register words 1111 to 1115 and words 1118 to 11120 ,it is faster to read words 1111 to 1120 as one block and just do nothing with words 1116 and 1117.