RS485 card for gaming machines

Communication protocol

Author: Peter Gasparik

Date: 18 October 1997

 

  1. Hardware Interface
  2. Communication protocol
  3. 9-bit data transfer format
  4. Message format

 

1. Hardware interface

Communication between the control computer and the Jackpot gaming machines is implemented via the serial communication interface based on the RS485 standard.   Interconnection type is called multi-drop which means that on the network there is one master device (control computer)  and one or more slaves (Jackpots).

RS485 interface works in half-duplex mode which means that only one device on the network can transmit data while the others must be in the receive mode. If, for some reason, two or more devices would decide to transmit simultaneously an erroneous data would be present on the lines. To avoid the collisions a special 9-bit communication protocol was implemented.

It is important that the connection cable is terminated with the 120 Ohm resistors on the each end of the cable. This is accomplished by shorting the jumpers present on the RS485 cards. Devices that are not at the end of connection cable must have termination jumpers open.

Shielded twisted pair cable was used to connect the RS485 network cards. The following picture shows correct connection between the control computer and the Jackpots.

 

2. Communication protocol

In order to avoid collisions on the network a special communication protocol is used. With this protocol the control computer can communicate with each slave device separately or, if required, it can talk to all of them simultaneously. Request-response data transfer allows the control computer to address certain device on the network, transmit the command and receive the response.

Each slave (gaming machine) on the network will be assigned an unique network address. If the master (control computer) decides to send a message it first transmits a network address of the device it wishes to talk to. All slave devices are in the receive mode listening for their address to appear on the RS485 bus. If the address match occurs, than the addressed slave prepares for the reception of the control command. Remaining slaves will ignore further communication until the new address is transmitted by the master. When addressed slave receives a command it perform requested operation and sends the response back to the master.

Another feature of the communication protocol is that the control computer can address all devices on the network simultaneously by transmitting a special address (0x99). When the slave devices see  this address they prepare themselves for the reception of the control command. After receiving the command they perform requested operation. Now, in order to avoid the collision on the bus, none of the slave devices transmit the response. They simply go back to the address recognition state.

Unique network addresses are initially assigned to the RS485 network cards during installation process and are retained within the internal EEPROM. Control computer command structure allows to change the network addresses dynamically in order to adapt to a new network configuration when devices are inserted into or removed from the network.

 

3. 9-bit data transfer format

To distinguish the data from address bytes each device on the RS485 network transmits information in 9-bit form. The most significant bit (D8) specifies the type of the transmitted byte. If D8 is set (log 1) then transmitted byte represents an address. Only master device can transmit address bytes and thus set the bit D8. Slave devices are always transmitting data having D8 cleared. Bits D0-D7 are used for transmission of information (address or data).

Device address is represented by one data byte (D0-D7) and address bit (D8) set to log 1. Once the address is transmitted master clears the D8 during the communication with the addressed slave device.

 

Each address or data byte has the following format:

Start bit

Data bit D0

Data bit D1

. . . . .

Data bit D7

Addr. bit D8

Stop bit

 

Data transmission speed has been set to 38400 baud in order to achieve satisfactory ratio between the reliability and the distance over which are data transmitted.

 

4. Message format

4.1 Envelope

Each command and response has the following envelope:

STX

VLI

Command or Response

ETX

LRC

Where:

STX (Start Of Text) has fixed value 0x02.

VLI (Variable Length Indicator) indicates the length of the command or response.

ETX (End Of Text) has fixed value 0x03.

LRC (Redundancy Check) is used to verify that the data in the message wasn't corrupt during transmission. LRC is calculated as XOR of all bytes in the message including STX, VLI and ETX.

4.2 Commands

Each command contains the command byte, slave address byte and the optional command data.

Command

Slave Address

Optional command data

 

4.2 Responses

Each response contains the response, slave address, operation result and the optional response data.

Response

Slave Address

Result

Optional response data