T-Series/Commands/Load Event Instruction

From ZaberWiki
Jump to: navigation, search

Load Event Instruction - Cmd 30

Warning: This is an "include" page. As such, its contents may be included in multiple other pages. To see a list of all pages that include this page, click on "What links here" in the bottom left navbar. If you make changes to this page, be sure that your changes are appropriate to all pages on which this content will be included. You are also encouraged to review our Zaber Wiki Editing Guidelines. This header will not be included in other pages.

Instruction Name Load Event Instruction
Applies to T-JOY
Firmware Version 5.04 and up
Command Number 30
Command Type Command
Command Data Key Event
Reply Data Key Event
Safe to retry? No
Returns Current Position? No
Persistence Non-Volatile
Summary Loads the next instruction as the event-triggered instruction specified in the Command Data.

When pressing and releasing a key (button on the T-JOY), there are a series of events that take place depending on how long the key is held. If the key is pressed and released before 1 second, the event sequence is 1-2. If the key is pressed, held for one second or more and then released, the event sequences is 1-3-4 (note that event 3 will be issued after the key is held for 1 second, and event 4 is issued upon release). This is illustrated in the figure below. The hold time of the key cannot be changed by the user.


Diagram of the event path for each key. The events are numbered from 1-4. This diagram shows what events are issued depending on how long you hold the key.
Diagram showing the numbering configuration for each key.



Each key event can be programmed to issue only one instruction. The instruction written to an event can be different for each key. You can also set an event to do nothing by issuing a echo command for that event.


When programming a T-JOY key, we recommend disconnecting all of the devices connected to the joystick. When a command is loaded to the key it is also sent to the connected devices and may cause unexpected movement. On a side note, it is important to know that when a command is issued it is sent to all devices. Only the devices that the command is addressed to will actually perform that command, and all of the other devices will ignore it.

If you are using message ids we recommend that you disable them when programming the joystick. That way the programmed instructions will work whether the target device has message ids enabled or not.


To program an instruction to a key event please follow these steps:

1. Send a Load Event Instruction Command #30 to the device # corresponding to the joystick, with a two digit command data value, where the first digit is the key number and the second digit is the event number. This command tells the device which key and event you would like to program an instruction for.

Diagram illustrating how to form the command data number for the load event instruction command




Example: If you want to program event #2 of Key #3 you would issue a Load Event Instructions command with a data value of 32.

2. Now that you have issued a Load Event Instruction command, The device is waiting for you to issue an instruction. At this point in time the Load Event Instruction command is volatile and will not persist after powering down (This means if you power down you will need to issue another Load Event Instruction command before sending the event instruction). The command that you issue now will be programmed to the key and event you specified in step 1. This command can be issued normally, and can be addressed to any device connected to and including the joystick.

Note: After issuing the command you wish to program, there will be no feedback (light, beep etc.) indicating you have correctly programmed the button. The response screen will only say that a command has been issued. If you see that your command has been issued immediately after the load instruction response then you have most likely correctly programmed the key. The best test is to manually test the key to see if it performs your command.


3. Now you have finished programming one event on a key. The instruction programmed to that key is now non-volatile and will persist after powering down. Repeat the steps above to continue programming events to keys. To set an event to do nothing, issue an Echo Data command to device number 255 for that event.


Important: Be sure to program all of the events each time you program a key. The key events may have instructions already programmed into them therefore you will have to program an event to either do nothing, or perform the command you want it to do. If you do not do this pressing a key could cause a device or joystick to do something unexpected. A list of the default settings can be found on the T-JOY installation page.


Key Event Programming Examples

Example 1: Programming a key to stop and home a single device.

In this example we will use device #3 as the device we want address the instructions to. Device #1 is the Joystick. We will program these instructions to key #4. We want device #3 to home when the key is pushed and held for 1 second and we want it to stop when the key is pushed and released before 1 second. The home instruction will be programmed to event number 3 and the stop instruction will be programmed to event number 2.

To program the device, follow the instructions listed below:

Device# Command Cmd# Cmd Data Description
1 Load Event Instuction 30 42 This command prepares the joystick key for instruction, the command data number 42 means that you are directing this instruction towards key #4 and event #2.
3 Stop 23 0 Because this command is being issued immediately after the Load Event Instruction (#30) it will be programmed to event #2 at key #4.
1 Load Event Instruction 30 43 This command prepares the joystick key for instruction, the command data number 43 means that you are directing this instruction towards key#4 and event #3.
3 Home 1 0 Because this command is being issued immediately after the Load Event Instruction (#30) it will be programmed to event #3 at key#4.


Example 2: Disable/Enable an Axis

In this example we will be disabling Axis #1. This axis usually controls device #2. The way that we are going to disable the axis is by reassigning the axis device number. This way the instruction will be sent to a device that will ignore a move command (the Joystick). We will be programming key #5. The key will disable the axis when pressed and released before 1 second and enable the axis when pressed, held for one second or more and then released.

To program the device, follow the instructions below:

Device# Command Cmd# Cmd Data Description
1 Load Event Instruction 30 51 This command prepares the joystick so that key #5 at event #1 can be programmed.
1 Set Active Axis 25 1 This command makes the axis active so that its device number can be changed. It is loaded to event number 1 so that the axis will become active as soon as the key is pressed.
1 Load Event Instruction 30 52 This command prepares the joystick so that key #5 at event #2 can be programmed.
1 Set Axis Device Number 26 1 This causes the axis to control the joystick, however all of the move commands sent to the joystick will be ignored. Therefore moving this joystick axis will not cause motion.
1 Load Event Instruction 30 53 This command prepares the joystick so that key #5 at event #3 can be programmed.
1 Set Axis Device Number 26 2 This command causes the axis to now control device number 2. This will enable the axis again by setting it to control Device #2, as before.
Personal tools
Zaber Website