Interested?

Getting Touch Information

Initializing Touch

Compared to our other products like Noritake GU‐D series, initializing touch on a GT‐CP module requires a few more commands. Four touch channels can be utilized to use three different touch detection modes:

Typically, touch is initialized by using the following procedure:

  1. Turn touch data transmission ON.
  2. Select the desired touch mode (single or multi‐touch) and the maximum number of touches.
  3. Select the desired touch detection mode (coordinate, custom switch, or switch matrix).

The initialization procedure for single touch coordinate mode is as follows:

  1. Enable touch data
    a. Byte code: 0x1f, 0x50, 0x20, 0x01 (touch data enable)
  2. Select maximum number of touches
    a. Byte code: 0x1F, 0x50, 0x01, 0x00 (single touch mode)
  3. Select coordinate mode
    a. Byte code: 0x1f, 0x50, 0x10, 0x00 (channel 0), 0x00

Note that there is no command used to select a touch channel. This is due to the fact that the module defaults to channel 0, so a command is not necessary if the channel is not being changed.
This procedure can be applied to any number of maximum touches and touch modes available.

Step 3 of the initialization procedure can be replaced to use switch matrix mode or custom switch mode. Examples of each initialization is as follows:

Select switch matrix mode (4 x 4 grid with 10 pixels in-between each switch):

  • Byte code: 0x1f, 0x50, 0x10, 0x00 (channel 0), 0x01, 0x04 (4 switches in X direction), 0x05 (non-touch area size in X direction), 0x04 (4 switches in Y direction), 0x05 (non-touch area size in Y direction)

Select custom switch mode (a single 100×100 pixel button at (0, 0)):

  • Byte code: 0x1f, 0x50, 0x10, 0x00 (channel 0), 0x02, 0x01 (1 button), 0x00, 0x00 (X coordinate), 0x00, 0x00 (Y coordinate), 0x00, 0x64 (X size), 0x00, 0x64 (Y size)

Interpreting Touch Data

Generally, it is a good idea to poll for the header byte (0x10) before reading the rest of the touch data packet. Since the data is sent when a touch is performed, your program needs to reliably recognize the header byte as to not miss any touch data. After the header byte has been confirmed, the byte packet for the configured touch mode will get read in and utilized in the desired gesture.

Coordinate Mode

This touch mode takes touch stimulus from anywhere on the screen and returns the x and y coordinate data for the touch location.

Single‐Touch Mode
This mode returns 6 bytes every time the touch panel is touched. The resulting byte sequence can be seen below:

Transmitted DataHex (value range)Data Length
(1) Header0x101 byte
(2) Identifier0x001 byte
(3) Data0x00 – 0xFF

4 bytes
tXL: x‐coordinate, lower byte
tXH: x‐coordinate, upper byte
tYL: y‐coordinate, lower byte
tYH: y‐coordinate, upper byte

The coordinate touch data is padded with one byte of 0x00 after the header byte. So, 6 reads need to be performed to receive a complete touch packet.

Multi‐Touch Mode
This mode returns 7 bytes every time the touch panel is touched. The resulting byte sequence can be seen below:

Transmitted DataHex (value range)Data Length
(1) Header0x101 byte
(2) Identifier0x10, 0x111 byte
(3) Touch number0x01 – 0x0A1 byte
(4) Data0x00 – 0xFF

4 bytes
tXL: x‐coordinate, lower byte
tXH: x‐coordinate, upper byte
tYL: y‐coordinate, lower byte
tYH: y‐coordinate, upper byte

This packet of touch data indicates more than just coordinate data. It also tells the host controller if the screen has been touched or released and how many concurrent touches there are.

Custom Switch Mode

This touch mode allows for up to 32 custom switches to be defined within the module’s viewing area. These switches act like virtual buttons on the touch screen.

Single‐Touch Mode
This mode returns 3 bytes every time a touch switch is touched. The resulting byte sequence can be seen below:

Transmitted DataHex (value range)Data Length
(1) Header0x101 byte
(2) Identifier0x021 byte
(3) Data0x01 – 0x20

1 byte
tn: Switch button number

The custom switch touch data is padded with one byte of 0x02 after the header byte. This packet of touch data indicates the number of the switch that has been touched.

Multi‐Touch Mode
This mode returns 3 bytes every time a touch switch is touched. The resulting byte sequence can be seen below:

Transmitted DataHex (value range)Data Length
(1) Header0x101 byte
(2) Identifier0x30, 0x311 byte
(3) Data0x01 – 0x20

1 byte
tn: Switch button number

This packet of touch data indicates the number of the switch that has been touched as well if the button has been touched or released.

Switch Matrix Mode

This touch mode creates a matrix/grid of touch switches on the touch screen that act like virtual buttons.

Single‐Touch Mode
This mode returns 4 bytes every time a touch switch is touched. The resulting byte sequence can be seen below:

Transmitted DataHex (value range)Data Length
(1) Header0x101 byte
(2) Identifier0x011 byte
(3) Data0x01 – 0x10

2 bytes
tX: x-direction switch number
tY: y-direction switch number

This packet of touch data indicates the switch number based on the switch grid that was created.
For example, the top‐left switch would have a tX and tY value of 1.

Multi‐Touch Mode
This mode returns 4 bytes every time a touch switch is touched. The resulting byte sequence can be seen below:

Transmitted DataHex (value range)Data Length
(1) Header0x101 byte
(2) Identifier0x20, 0x211 byte
0x20: Released
0x21: Touched
(3) Data0x01 – 0x10

2 bytes
tX: x-direction switch number
tY: y-direction switch number

This packet of touch data indicates if a touch or a release has occurred on a switch. The switch indication is the same as single‐touch mode.

For more information, refer to your module’s respective specification.