mycnc:modbus_setup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
mycnc:modbus_setup [2019/09/12 10:40] – ivan | mycnc:modbus_setup [2020/01/27 11:42] – ivan | ||
---|---|---|---|
Line 56: | Line 56: | ||
====Modbus Devices available==== | ====Modbus Devices available==== | ||
The detailed description of the available Modbus devices is located at the [[mycnc: | The detailed description of the available Modbus devices is located at the [[mycnc: | ||
+ | |||
+ | ====Sample M03 procedure for Spindle ON through Modbus==== | ||
+ | |||
+ | ++++ Expand M03 code | | ||
+ | |||
+ | < | ||
+ | #include vars.h | ||
+ | |||
+ | #define command | ||
+ | #define parameter var01 | ||
+ | |||
+ | // ======================================================================= | ||
+ | // | ||
+ | #define SPINDLE_ON_CW_VALUE | ||
+ | // ======================================================================= | ||
+ | |||
+ | main() | ||
+ | { | ||
+ | proc=plc_proc_spindle; | ||
+ | |||
+ | timer=0; | ||
+ | val=eparam; | ||
+ | |||
+ | message=PLCCMD_MODBUS_SPINDLE_CMD; | ||
+ | command=SPINDLE_ON_CW_VALUE; | ||
+ | parameter=SPINDLE_ON_CW_VALUE; | ||
+ | timer=10; do{timer--; | ||
+ | |||
+ | message=PLCCMD_MODBUS_SPINDLE_SPEED; | ||
+ | command=val; | ||
+ | parameter=val; | ||
+ | timer=30; do { timer--; } while (timer> | ||
+ | |||
+ | |||
+ | gvarset(7370, | ||
+ | timer=10; do { timer--; } while (timer> | ||
+ | gvarset(7371, | ||
+ | timer=10; do { timer--; } while (timer> | ||
+ | |||
+ | //delay after spindle started | ||
+ | timeout=timer+spindle_on_delay; | ||
+ | do{timer++; | ||
+ | |||
+ | exit(99); | ||
+ | }; </ | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | This M03 procedure can be found by going into Settings > Config > PLC > Hardware PLC Templates > Mill (Modbus): Spindle CW Turn-ON. | ||
+ | |||
+ | * As can be seen in the sample code, the '' | ||
+ | |||
+ | {{: | ||
mycnc/modbus_setup.txt · Last modified: 2020/07/03 11:26 by ivan