How to show button using if-then condition

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
DesertRider
Posts: 59
Joined: Mon Nov 30, 2020 6:49 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 1116203993
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Phoenix, Az

How to show button using if-then condition

Post by DesertRider »

Hello, I have begun customizing my Acorn VCP. I have a KP-3 touch probe and probe detect is on Input 6 of Acorn, whereas probe tripped is on Input 7.

I would like to add a probe display (not press button) with conditional appearance combining inputs 6 and 7. For example, if Input 6 is OFF, there would be one SVG image (say "probe not present") . If input 6 is ON and Input 7 is OFF the button shows one way (e.g. probe present in green; that would be the default, probe connected but not tripped). If tripped, it would show "Tripped" in red.

I was able to create two buttons (probe_detected reading input 6 and probe_tripped reading input 7) with the desired functionality, but would like to combine them. Is there a specific syntax I can use in the xml. Apologies if this is trivial, I have no xml experience. The esthetics of these buttons are irrelevant for now, and I will ultimately combine them into one informational display, but I need to know how to use both inputs with the if-then clause. THANK YOU.

This is what I have so far:

Code: Select all

<vcp_button>
	<plc_input>
		<number>6</number>
		<image_on>probe_detected_yes.svg</image_on>
		<image_off>probe_detected_no.svg</image_off>
	</plc_input>
</vcp_button>

Code: Select all

<vcp_button>
	<plc_input>
		<number>7</number>
		<image_on>probe_trip.svg</image_on>
		<image_off>probe_clear.svg</image_off>
	</plc_input>
</vcp_button>
IMG_3098.jpg
IMG_3099.jpg


dpascucci_support
Posts: 93
Joined: Thu Sep 21, 2023 9:24 am
Acorn CNC Controller: No
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: No
CNC11: No
CPU10 or CPU7: No

Re: How to show button using if-then condition

Post by dpascucci_support »

Thinking through it more, I think I thought of a way to get it to work, but it involves adding logic to the PLC.

Edit: It can be done. It involves adding 3 lines of logic to the plc. 3 buttons are mapped to the same vcp coordinate, emulating one button with three states instead of just two.
Domenic

When requesting support READ THIS POST first.

Please ALWAYS post a FRESH report.

(We pride ourselves on providing timely solid technical support but, without good information we may not be able to help and/or reply until such information is posted.)


DesertRider
Posts: 59
Joined: Mon Nov 30, 2020 6:49 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 1116203993
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Phoenix, Az

Re: How to show button using if-then condition

Post by DesertRider »

Thank you for the reply. Any thoughts on how one could do it through the PLC?


dpascucci_support
Posts: 93
Joined: Thu Sep 21, 2023 9:24 am
Acorn CNC Controller: No
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: No
CNC11: No
CPU10 or CPU7: No

Re: How to show button using if-then condition

Post by dpascucci_support »

You'll need three new memory bits for each condition (NoProbe_M, ProbeClear_M, ProbeTripped_M) and in the mainstage add the logic such that the correct memory bit is SET given the current input states. Make sure that only 1 memory bit is SET at any given moment (ie when you SET one, RST the other two). Then compile the program. Refer to the PLC manual for more information on the logic and Setting/Resetting memory bits: https://www.centroidcnc.com/centroid_di ... manual.pdf

For the VCP buttons, create three buttons and map them to the coordinate you want and have them watch the corresponding memory using the <plc_memory> and <number> tags. Set the SVGs of your choosing as with <image_on> and set a blank SVG with <image_off> (you can grab a blank svg from wikipedia here if you need: https://en.wikipedia.org/wiki/File:Blank.svg

When done correctly, you'll have all three buttons mapped to one place, and only one of the buttons will be visible at a time.
Domenic

When requesting support READ THIS POST first.

Please ALWAYS post a FRESH report.

(We pride ourselves on providing timely solid technical support but, without good information we may not be able to help and/or reply until such information is posted.)


cncsnw
Posts: 4090
Joined: Wed Mar 24, 2010 5:48 pm

Re: How to show button using if-then condition

Post by cncsnw »

Doesn't the developmental v5.08 software have a new VCP feature for showing/hiding buttons and other elements in response to PLC conditions?

That would eliminate the need for "blank" SVG files when a button is not present.


dpascucci_support
Posts: 93
Joined: Thu Sep 21, 2023 9:24 am
Acorn CNC Controller: No
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: No
CNC11: No
CPU10 or CPU7: No

Re: How to show button using if-then condition

Post by dpascucci_support »

Point 5 in the v5.08 release notes (https://centroidcncforum.com/viewtopic.php?f=67&t=9517) describes the Switching functionality. This method requires button groups to be defined but it can absolutely be done.
Domenic

When requesting support READ THIS POST first.

Please ALWAYS post a FRESH report.

(We pride ourselves on providing timely solid technical support but, without good information we may not be able to help and/or reply until such information is posted.)


DesertRider
Posts: 59
Joined: Mon Nov 30, 2020 6:49 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 1116203993
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Phoenix, Az

Re: How to show button using if-then condition

Post by DesertRider »

I am currently on 4.6.4. and my system works perfectly. I was somewhat reluctant to update but sounds like that is necessary. Will try to do it over the weekend. I very much appreciate the replies; while programming the PLC seems way out of my skill set will look up the manual and decide if I want to try it.


Post Reply