Next: 8. PID Axis Tuning Up: 7. Servo To Go Previous: 7.4 What is the Contents Index

# 7.5 stgdiag

Included in the EMC distribution is a diagnostics program to help verify the Servo To Go hardware. The source code for the program is typically located in:
/usr/local/emc/src/emcmot/stgdiag.c

There are two versions of the executable (depending on whether it is linked with stg.c or stg2.c). stgdiag is for the Model 1 card and stg2diag is for the Model 2. The executables are usually located in:
/usr/local/emc/plat/nonrealtime/bin/

To run the program, either navigate to the above directory, or have it on your path. The syntax is (using the Model 2 version as the example):

`stg2diag [ dio | dac | limit | home | index <axis> | latch <axis>][ base_address ]`

first set of options:

`none` `position for x, y, and z continuously updated, control-C to quit`
`dio` `digital I/O, displays state of ports A, B and D`
`dac` `digital to analog converter, prompts for axis, then prompts for voltage`
`limit` `displays limit switches continuously, new line at each change, control-C to stop`
`home` `displays home switches continuously, new line at each change, control-C to stop`
`index <axis> continuously display state of index pulse for given axis, control-C to stop`
`latch <axis> continuously display state of index pulse latch, control-C to stop`

Default base address is 0x200 unless the base address is specified in the final argument.

lstg

There is another program available to help debug and verify the Servo To Go hardware functionality. It is available from the Servo To Go website in the Download Area. Like stgdiag, it is a console application. However lstg is more general, and has slightly more functions. Here is an example of its use:

`[root@mclinux don]# lstg`
`Servo To Go Demo`

Enter the letter corresponding to the desired command. You don't need to follow it with a carriage return. If the letter isn't a valid command, the list of commands will be repeated. To exit from a demo, type any character.
Base Address = 200
Board Model = Model 2
ServoToGo: [carriage return]
Commands:
o - Digital output demo, toggle bit
i - Digital input demo
D - DAC demo for chan 3, ramp
d - DAC demo, set voltage
r - Some random motion on chan 0
a - ADC demo
A - ADC autozero ON
n - ADC noise demo
N - ADC autozero OFF
e - Encoder demo
E - Zero Encoders
x - Index pulse demo
X - Index latch demo
l - External Latch Test
y - IRR test, continually reset index latch
1..8 - Set default Axis
q - Quit

Next: 8. PID Axis Tuning Up: 7. Servo To Go Previous: 7.4 What is the Contents Index