Example Analysis of the Secondary Development of GTS- 800
This article will explain in detail the example analysis about the secondary development of GTS- 800. the editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
1. Open the controller GT_Open
2. Start servo enable GT_ClrSts
3. Axis planning position zeroing GT_SetPrfPos
4. Axis motion mode GT_PrfTrap
5. Axis target position GT_SetPos
6. Shaft rotation speed GT_SetVel
7. Startup axis GT_Update
8. Turn off enable GT_AxisOff
9. Close the controller GT_Close
C#:using System;using System.Collections.Generic;using System.Linq;using System.Text;using gts;namespace GTS {class Program {static void command (string sz, short nR) {Console.WriteLine (sz + "=" + nR);} static void Main (string [] args) {short mAxis = 2; short nR = mc.GT_Open (0,1) If (nR! = 0) {command ("GT_Open", nR); Console.WriteLine ("Open error"); return;} command ("GT_Open", nR) / clear the alarm and limit command of each axis ("GT_ClrSts", mc.GT_ClrSts (mAxis, 1)); / / Servo enable command ("GT_AxisOn", mc.GT_AxisOn (mAxis)); / / position zero command ("GT_ZeroPos", mc.GT_ZeroPos (mAxis, 1)) / / Axis planning position zeroing command ("GT_SetPrfPos", mc.GT_SetPrfPos (mAxis, 0)); / / setting the specified axis as the point motion mode. Command ("GT_PrfTrap", mc.GT_PrfTrap (mAxis)); / / set point motion parameters mc.TTrapPrm trap = new mc.TTrapPrm (); trap.acc = 0.25; trap.dec = 0.125; trap.smoothTime = 25; command ("GT_SetTrapPrm", mc.GT_SetTrapPrm (mAxis, ref trap)) / / set the target position of the axis command ("GT_SetPos", mc.GT_SetPos (mAxis, 50000)); / / set the target speed of the axis command ("GT_SetVel", mc.GT_SetVel (mAxis, 25)); / / start the axis motion command ("GT_Update", mc.GT_Update (1)