341
Mach4 General Discussion / Re: Understanding Mach 4 LUA scripting capabilities
« on: January 16, 2019, 11:48:48 AM »
Hey Mcardoso,
I'll answer your questions best I can.
1) If you download Mach4 there will be a folder in the main Mach4 Directory called Docs. In here there are manuals, one of which is a LUA scripting manual and there is another API File that has all the Mach Specific Lua Calls.
2) I don't know anything about ASCII except that it is for communications. Mach4 has a modbus protocol, RS232 is one of the protocols. You can utilize the information received over modbus inside LUA functions and scripts.
3) The PLC Script is the script that continuously runs in the background, you can change the scan time inside Mach4. You have other functions that will run from the screen load script only when they are called from another source. Example, a button press can call a function. Some functions can lock up, or take over, Mach's GUI so you can make coroutines that will run the functions and keep everything else rolling as well. There is a video about coroutines on YouTube from another Mach4 user, DaztheGas, go check it out; highly informational.
3. There are TONS of examples that have been shared and Mach4 comes with several examples from Automatic Tool Change routines, to turning on and off outputs, to advanced file functions.
This forum is a great place to learn and share your experiences with Mach4.
I'll answer your questions best I can.
1) If you download Mach4 there will be a folder in the main Mach4 Directory called Docs. In here there are manuals, one of which is a LUA scripting manual and there is another API File that has all the Mach Specific Lua Calls.
2) I don't know anything about ASCII except that it is for communications. Mach4 has a modbus protocol, RS232 is one of the protocols. You can utilize the information received over modbus inside LUA functions and scripts.
3) The PLC Script is the script that continuously runs in the background, you can change the scan time inside Mach4. You have other functions that will run from the screen load script only when they are called from another source. Example, a button press can call a function. Some functions can lock up, or take over, Mach's GUI so you can make coroutines that will run the functions and keep everything else rolling as well. There is a video about coroutines on YouTube from another Mach4 user, DaztheGas, go check it out; highly informational.
3. There are TONS of examples that have been shared and Mach4 comes with several examples from Automatic Tool Change routines, to turning on and off outputs, to advanced file functions.
This forum is a great place to learn and share your experiences with Mach4.