Server API, Jog control
Command "SetJog" is used for Jog control through Srever API.
Command syntax is "SetJog Parameter". Parameters listed in table below
Parameter | Description |
x+ | start jog X+ direction |
x- | start jog X- direction |
y+ | start jog Y+ direction |
y- | start jog Y- direction |
z+ | start jog Z+ direction |
z- | start jog Z- direction |
a+ | start jog A+ direction |
a- | start jog A- direction |
b+ | start jog B+ direction |
b- | start jog B- direction |
c+ | start jog C+ direction |
c- | start jog C- direction |
x+y+ | start jog in 2 axes X+,Y+ directions |
x-y- | start jog in 2 axes X-,Y- directions |
x+y- | start jog in 2 axes X+,Y- directions |
x-y+ | start jog in 2 axes X-,Y+ directions |
xstop | stop jog in X axis |
ystop | stop jog in Y axis |
zstop | stop jog in Z axis |
astop | stop jog in A axis |
bstop | stop jog in B axis |
cstop | stop jog in C axis |
xystop | stop jog in X, Y axes |
Server API, Pendant control emulation
Server API has a command to simplify Pendant control emulation. This command can be used for writing third-patry Pendant control device drivers.
Command | Description |
SetPendant |
Format: Parameter1 - Emulated Handwheel position. It's supposed the handwheel has reolution "100", position range can be (0...99) |
Example: | |
SetPendant 50;0x0300 <Axis=OFF, Mul=1, Wheel=50 - initial position> SetPendant 50;0x0301 <Axis=X, Mul=1, Wheel=50 - Turn ON X axis> SetPendant 55;0x0301 <Axis=X, Mul=1, Wheel=55 - Rotate wheel +5 "clicks", will move X +5*1.0=5.0 mm> SetPendant 55;0x0302 <Axis=Y, Mul=0.01, Wheel=55 - Switch to Y axis> SetPendant 65;0x0302 <Axis=Y, Mul=0.01, Wheel=65 - Rotate wheel +10 "clicks", will move Y +10*0.01=+0.1 mm> SetPendant 65;0x0302 <Axis=Z, Mul=0.1, Wheel=65 - Switch to Z axis> SetPendant 50;0x0302 <Axis=Z, Mul=0.1, Wheel=50 - Rotate wheel -15 "clicks", will move Z -15*0.1=-1.5 mm> |
{avsplayer videoid=6}
Hardware outputs (binary, DAC, PWM) manipulation thourgh Server API.
There are 3 ways to manipulate myCNC control board Hardware outputs through Serve API:
- Direct manipulation through commands "SetHWBinaryOutput", "SetHWDAC", "SetHWPWM"
- Manipulation through running PLC procedure with Hardware Outputs manupulation.
- Manipulation thourgh running short G/M-codes program
Direct Manipulation.
Command | Description |
SetHWBinaryOutput |
SetHWBinaryOutput <Port number> <Port value> SetHWBinaryOutput 0 1 <Turn ON binary output #0> |
SetHWPWM |
SetHWPWM <PWM channel> <PWM value> SetHWPWM 0 0 <Set value "0" to PWM#0 (PWM1). Max PWM value is 4095> SetHWPWM 2 3500 <Set value "3500" to PWM#2 (PWM3). Max PWM value is 4095> SetHWPWM 1 4095 <Set value "4095" (Maximum) to PWM#1 (PWM2). Max PWM value is 4095> |
SetHWDAC |
SetHWDAC <DAC channel> <DAC value>
SetHWDAC 0 0 <Set value "0" to DAC#0 (DC1). Max DAC value is 4095> SetHWDAC 1 4095 <Set value "4095" (Maximum) to DAC#1 (DAC2). |
Manipulation through PLC procedure.
Server API command "RunPLC" loads and runs PLC procedure on myCNC controller end with given parameter. We can run PLC procedure that manipulates Hardware outputs to get similar result.
Normally every profile configuration contains PLC procedures for Hardware outputs manipulation :
PLC procedure | Syntax |
M62 |
M62 <Parameter> M62 1 <Turn ON binary output #1> |
M63 |
M63 <Parameter> M63 0 <Turn OFF binary output #0> M63 15 <Turn OFF binary output #15> |
DAC |
DAC <Parameter> Example: DAC 0 <Set value "0" to DAC#0 (DAC1). Max DAC value is 4095>DAC 0x0600 <Set value "0x600" (1536) to DAC#0 (DAC1). Max DAC value is 4095> DAC 0x1400 <Set value "0x400" (1024) to DAC#1 (DAC2). Max DAC value is 4095> DAC 0x1000 <Set value "0" to DAC#1 (DAC2). Max DAC value is 4095> |
PWM |
PWM <Parameter> Example: PWM 0 <Set value "0" to PWM#0 (PWM1). Max DAC value is 4095>PWM 0x0600 <Set value "0x600" (1536) to PWM#0 (PWM1). Max PWM value is 4095> PWM 0x1400 <Set value "0x400" (1024) to PWM#1 (PWM2). Max PWM value is 4095> PWM 0x2000 <Set value "0" to PWM#2 (PWM3). Max PWM value is 4095> |
Examples to run PLC procedures through Server API shown in a table below
Binary input manipulation |
RunPLC M62 1 <Turn ON output#1> |
PWM control |
RunPLC PWM 0x1350 <Write to PWM#1 (PWM2) value 0x350> |
SetHWDAC | RunPLC DAC 0x1570 <Write to DAC#1 (DAC2) value 0x570> RunPLC DAC 0x800 <Write to DAC#0 (DAC1) value 0x800> RunPLC DAC 0x0 <Write to DAC#0 (DAC1) value 0> RunPLC DAC 0x1000 <Write to DAC#1 (DAC2) value 0> |
{avsplayer videoid=4}
Manipulation through running G-codes.
Server API command "SinglePlay" run G-code line (or a number of G-code lines divided by symbol ";" ).
It's possible to control binary outputs by running M-functions "M62", "M63". P-parameter set binary output number to control.
M-code | Syntax |
M62 |
M62 P<number M62 P1 <Turn ON binary output #1> |
M63 |
M63 P<number> M63 P0 <Turn OFF binary output #0> M63 P15 <Turn OFF binary output #15> |
Any custom PLC function can be written and assigned to M-code, then loaded through CNC Server API.
{avsplayer videoid=5}
How to change Scale and Rotation Angle.
There are 2 version of command "SetScale" in the Server API to change scale of given g-code file.
For both commands g-code program should be loaded to myCNC by runnig command "ProgramFileOpen"
Format: ProgramFileOpen <filename>
Example:
ProgramFileOpen /sk/DNC/3d3.nc |
1) Command "SetScale".
Format: SetScale <scale>
Example:
SetScale 3.5 |
(myCNC software will open g-code file defined by command "ProgramFileOpen", scale it to factor 3.5 and load result to myCNC memory).
If "SetScale" command used several times, previous "scale" ratios are ignored. myCNC software uses original g-code file and the last "scale" ratio to generate scaled program.
{avsplayer videoid=3}
2)Command "SetScale++".
For some applications "scale" ratio should be used together with g-codes rotation. In this case commands "SetScale++" and "SetRotationAngle++" should be used.
When running "SetScale++" command "scale" ratio is latched to 'Scale&Rotation" structure. If running "SetRotationAngle++" myCNC software loads g-code file, given with "ProgramFileOpen" commands and perform rotation and scale with given Angle and Scale.
Example:
SetScale++ 2.75 |
{avsplayer videoid=1}