Tips For Instructing to Generate a Code

This section describes tips for writing an effective prompt in generating a code for SPEL+.

1. Explain the purpose and motion clearly

Good example:

- Create a program that makes the robot move back and forth between 3 points.
- Write a code that monitors the I/O signal, and stops the robot when the signal turns ON.
- Create a program that picks up workpieces in order, from a 4x3 array using palette processing.

Bad example:

- Create a program that moves the robot.
- Write a code.

2. Be specific about which command and function to use

- Use the Go command to move to the target position P1.
- Loop processing using For...Next statement
- Conditional branching using If...Then statement

3. Clearly state the requirements and names of the variables and constants

- Manage the counter with an Integer variable i
- Declare a Real-type one-dimensional array variable with 11 elements (indexes 0-10)
- Make the Global variable g_PartsCount accessible from other programs

4. State the requirements for handling errors

- Include the error processing using the OnErr statement
- Add the Print statement to check whether the operation has been complete

5. Specify the program structure

- Create it as a sub function to call from the Main function
- Create a program that can execute on its own

6. Provide the details of the I/O specification

- Start the program with the input signal In (1)
- Turn on the lamps with the output signal Out (10)

7. Specify the motion parameter

- Operate at 50% speed
- Set the acceleration speed to 30

8. Indicate the sample code requirements

- Explain in detail with comments
- Explain it in a way that is easy to understand for beginners