PinKit Communication and Commands (Messages)

For an overview of the PinKit system, see the PinKit Home Page.

The PinKit boards communicate over a an industry-standard, high-speed serial bus called Controller Area Network (CAN).  CAN is used in the auto industry and for manufacturing controllers.  It is a two-wire bus designed for electrically noisy environments.  CAN controllers provide error checking with retry on error.  In other words, CAN provides reliable message transport.  CAN defines the physical layer protocol that sends and receives messages of up to eight bytes, but does not define the content of those messages.

PinCAN expands on the CAN bus by adding a pre-defined set of messages designed for pinball machine control.  Each PinCAN message is two bytes long, one byte of op-code and one byte of data.  Up to 3000 messages per second can be sent across the bus with latency of about 0.5 millisecond.

Messages are sent through a programming interface in standard "C" programming language. A pre-defined set of constants are provided that facilitate the function calls needed to send messages.

The following table provides an overview of the types of messages that are supported. An example of the C function call to generate the message is also provided.

Type Description

Coil The coil message pulses a coil or turns a coil on or off.

Example: pk_send_msg(MSG_COIL_PULSE, COIL_ID);

Switch

The switch message reports a switch event: on, off, or pulse.

Example:  pk_send_msg(MSG_SWITCH_PULSE, SWITCH_ID);

Lamp

The lamp message turns a lamp off, on at a specified brightness level and/or blink rate.  Lamps can be grouped so a single command can control a set of lights (e.g. all GI lamps can be in a single group).

Example:  pk_send_msg(MSG_LAMP_ON, LAMP_ID);

Score

The score message reports a score event which increases the current player's score by a specifiied amount.

Example:  pk_send_msg(MSG_SCORE, SCORE_500);

Sound

The sound message requests a sound to be played on one of four sound tracks.  It can be played once, repeated, or turned off.

Example:  pk_send_msg(MSG_SOUND_TRACK1, SOUND_ID);

Control

Control messages handle miscellaneous machine and game functions, for example: reset, new game, new ball, tilt, and game over.

Example:  pk_send_msg(MSG_CONTROL, NEW_BALL);

Typically, one controller is designated the master that controls the game state and function.  However, messages can be sent by any controller.  All controllers receive all messages.  The controller checks the message and discards it if it isn't applicable.

Return to Kerry's PinKit page