Need to add a button on main screen of Tomas2 profile instead of “CV” button.
The button should toggle output #6
The button should have built-in LED indicator to show current Output Pin state.
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"/>
where=“work-toolbar” - Widget name to put the button
type=“xbutton” - Type for button with buil-in LED indicator
height=“60” - Size for button. It's supposed square button if No “width” attribute given
image=“outputs/transistor-off” - Skin image for the button
xattr=“2;38;20;20;led;green;round” - Built-in Led indicator type, color, position and size
address=“outputs” number=“6”- Address (inputs or outputs) and pin number to show state
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 -