The button code in cnc-screen.xml will look as
<gitem where="work-toolbar" type="xbutton" height="60" image="outputs/transistor-off" action="soft-plc-run:__TR" xattr="2;38;20;20;led;green;round" address="outputs" number="6"/>
Software PLC procedure source code to toggle output pin will be as follow
main() { a=portget (0x406); //read current state of output #6 if (a==0) {portset(6);} else {portclr(6);}; exit(99); };
To add Software PLC procedure -