* SETPROTOCOL ch, mode {* Applicable only to M+ PLC with r34 firmware}

Purpose

A T100M+ series PLC automatically senses the type of communication protocols sent to it and responds accordingly. You may however fix the protocol type so that it does need to check the protocol type before responding. This command also allows he PLC to be defined as "No Protocol" so that it will not automatically respond to data that it receives which appears like one of the supported protocols. This may be important in some applications in which the PLC serial port is used purely to receive incoming data via INCOMM and INPUT$ and you do not want it to respond to some data that appears to it as a valid communication protocols This is also useful for implementing user’s own communication protocol without worrying about conflict with the existing protocols.

ch = 1, 2 or 3 (COMM port number)

mode

0 - Auto sensing (default mode)
1 - Fixed at RTU mode
2 - Fixed at EMIT mode
3 - Fixed at MODBUS ASCII mode
4 - Fixed at OMRON C20H protocol mode
5 - Fixed at NATIVE host link command mode
10- No protocol. (For creating user own custom protocol.

IMPORTANT: Please note that if you set the protocol to other than the "Native" (mode=5) or "Auto" (mode=0) that serial port will no longer respond to commands from TRiLOGI and you will encounter "Communication Errors" when you try to perform any communication using TRiLOGI with that serial port. You can still use the other unaffected serial port (e.g. COMM3, RS485) that support host link commands.

To regain communication with the serial port you will have to execute another SETPROTOCOL function that set it to mode 0 or 5 (assuming it has been written into the program), or you must reset the controller by turning OFF the power and then ON again. If you execute a SETPROTOCOL using the 1ST.Scan then you must turn on DIP switch #4 before powering up the PLC so that the SETPROTOCOL command will not be executed and you can regain control of the PLC using TRiLOGI.

backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual