Programming Examples 


 

The following examples are presented to illustrate the functionality of each command.

Most of the examples are based on x-axis-absolute-move.txt  example that moves the X-motor to go back and forth.
 

Example 1:

The following example sets the acceleration, and velocity values. Then instructs the X-motor to make an absolute move. The absolute moves are referenced to the zero point.

x-axis-absolute-move.txt

 
Example 2:

The following example sets the acceleration, and velocity values. Then instructs the X-motor to find the home position. A normally closed (or normally low) switch should be place between the Home pin and the system ground. Please consult the hardware reference manual.

x-axis-homing.txt
 

Example 3:

The following example sets the acceleration, and velocity values. Then instructs the X-motor to jog.

x-axis-jogging.txt
 
The following example moves the X-motor and at the end of each move disables the motor driver.

x-axis-moff-mon.txt
 
Example 4:

The following example sets the acceleration, and velocity values. Then instructs the X-motor to make an relative move. The relative moves are referenced to the last point.

x-axis-relative-move.txt
 
Example 5:

The following example shows how to read the quadrature inputs.

x-axis-rquad1.txt
 
Example 5:

The following example shows how to assign a different value to the current position.

x-axis-sposx.txt
 

Example 6:

The following example illustrates how to stop a motor.

x-axis-stop.txt
 

Example 7:

The following example shows how to turn on or turn off a TTL / CMOS output. This command is useful for controlling other devices like a relay, solenoid, light, or handshaking with other devices.

clrbit-setbit.txt
 

Example 8:

The following example illustrates the usage of subroutines.

gosub-return.txt
 

Example 9:

The following example shows the usage of IF, ELSE and THEN commands. These commands are used to change the flow of program based on different conditions.

if-then-else.txt
 
Example 10:

The following example shows the usage of IFBIT, ELSE and THEN commands. These commands are used to change the flow of program based on state of a specific TTL / CMOS input.

ifbit-then-else.txt
 
Example 11:

The following example shows the usage of IFNOTBIT, ELSE and THEN commands. These commands are used to change the flow of program based on state of a specific TTL / CMOS input.

ifnotbit-then-else.txt
 

Example 12:

The following example shows how to read all TTL / CMOS inputs and write to all TTL / CMOS outputs.

in-out.txt
 

Example 13:

The following example shows the usage of INPUT command. INPUT may be used for receiving numerical information from the serial port.

input.txt

 
Example 14:

The following example shows the usage of 32-bit variables.

variables.txt
 

Example 15:

The following example demonstrates the usage of coordinated moves.

line-circle.txt
 

Ask a Question

 



Home | Products | Accessories | Knowledge Center | About Us | Terms of Use |Testimonials | Featured Products |Site Map | Videos | Contact Us