Coding for a VCP button
Moderator: cnckeith
-
- Posts: 58
- Joined: Mon Apr 22, 2019 11:22 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: none
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
Coding for a VCP button
Are there any good examples of coding a button in the VCP ?
I don't mean calling a macro, i mean code as the button needs to work when a NC program is running.
Hopefully the example shows the steps for the build process and the inclusion of the button graphics etc..
I don't mean calling a macro, i mean code as the button needs to work when a NC program is running.
Hopefully the example shows the steps for the build process and the inclusion of the button graphics etc..
- Attachments
-
- IMG_20190831_203721 - Copy.jpg (54.34 KiB) Viewed 5142 times
-
- Posts: 7313
- Joined: Wed Mar 03, 2010 4:23 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: Yes
- Oak CNC controller: Yes
- CNC Control System Serial Number: none
- DC3IOB: Yes
- CNC11: Yes
- CPU10 or CPU7: Yes
- Contact:
Re: Coding for a VCP button
the VCP is a 'skin' you can learn more about 'Skinning" in the Skinning folder int he cncm directory.
the VCP is built in Microsoft Visual Studio using C#
the coming updated version of the VCP will have an intermediate file that it "looks" to to build the buttons. this will be an XML file that is user editable. user will be able to edit the XML file to change the buttons colors, Text, and function.
the VCP is built in Microsoft Visual Studio using C#
the coming updated version of the VCP will have an intermediate file that it "looks" to to build the buttons. this will be an XML file that is user editable. user will be able to edit the XML file to change the buttons colors, Text, and function.
Need support? READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
Re: Coding for a VCP button
What kind of action do you have in mind for the button?
Graphics aside, most of an implementation would be in your PLC program.
For example, whenever the button you have circled is touched, your PLC program should see SV_SKIN_EVENT_24 "SkinAux13_M" on (1). When that button is not pressed, the bit would be off (0).
Graphics aside, most of an implementation would be in your PLC program.
For example, whenever the button you have circled is touched, your PLC program should see SV_SKIN_EVENT_24 "SkinAux13_M" on (1). When that button is not pressed, the bit would be off (0).
-
- Posts: 58
- Joined: Mon Apr 22, 2019 11:22 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: none
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
Re: Coding for a VCP button
I would like to implement this....
Button
toggle #109 between the values 1 and 0
if #109 == 1 then show the active light in the corner of the button
When a NC program is run the value of #109 may be set in the G code, i'd like the active light to reflect the state of #109
A bit like how the flood and spindle buttons work.
Button
toggle #109 between the values 1 and 0
if #109 == 1 then show the active light in the corner of the button
When a NC program is run the value of #109 may be set in the G code, i'd like the active light to reflect the state of #109
A bit like how the flood and spindle buttons work.
Re: Coding for a VCP button
To do exactly what you describe is not possible. Only the PLC program can respond in real time to button presses, and the PLC program does not have access to CNC variables such as #109.
You can achieve your intent by using a memory bit in the PLC program instead of a CNC variable.
The PLC program can then set and clear the bit in response to button presses, and can light up the LED when the bit is set.
If you need the CNC program to also be able to set and clear the bit, then you can use an M94/M95 request.
The CNC program cannot test the state of M94/M95 flags, but it can test PLC output bits (including the jog panel outputs for Aux LEDs).
For example, the appropriate sections of your PLC program could include:
Your CNC program could check status by looking at the Aux13LED bit (OUT1080, CNC variable #61080). It can change the status using M94 and M95.
For example:
The PLC code above:
is a standard method of toggling a bit on and off with a keypress. Using the XOR operator (^), the new value of SpecialRequest_SV is the same as the old value if the key has not been pressed, and is the opposite of the old value if the key has been pressed.
Note that the PLC program is allowed to change the value of an M94/M95 request flag. In between PLC scans, the CNC program might also change the value of that same request flag using M94 or M95.
You can achieve your intent by using a memory bit in the PLC program instead of a CNC variable.
The PLC program can then set and clear the bit in response to button presses, and can light up the LED when the bit is set.
If you need the CNC program to also be able to set and clear the bit, then you can use an M94/M95 request.
The CNC program cannot test the state of M94/M95 flags, but it can test PLC output bits (including the jog panel outputs for Aux LEDs).
For example, the appropriate sections of your PLC program could include:
Code: Select all
SpecialRequest_SV IS SV_M94_M95_123
; ...
Aux13PD IS PD78
; ...
IF SkinAux13_M THEN (Aux13PD)
IF SpecialRequest_SV ^ Aux13PD THEN (SpecialRequest_SV), (Aux13LED)
For example:
Code: Select all
IF [#61080 == 0] THEN GOTO 200 ; if no request, then skip
; do some special action...
M95/123 ; clear the request until next time
N200
; continue normal operation
The PLC code above:
Code: Select all
IF SkinAux13_M THEN (Aux13PD)
IF SpecialRequest_SV ^ Aux13PD THEN (SpecialRequest_SV), (Aux13LED)
Note that the PLC program is allowed to change the value of an M94/M95 request flag. In between PLC scans, the CNC program might also change the value of that same request flag using M94 or M95.
-
- Posts: 58
- Joined: Mon Apr 22, 2019 11:22 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: none
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
Re: Coding for a VCP button
Many many thanks for such a detailed answer.
I'll start reading the PLC stuff now.
Thanks.
I'll start reading the PLC stuff now.
Thanks.
-
- Posts: 7313
- Joined: Wed Mar 03, 2010 4:23 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: Yes
- Oak CNC controller: Yes
- CNC Control System Serial Number: none
- DC3IOB: Yes
- CNC11: Yes
- CPU10 or CPU7: Yes
- Contact:
Re: Coding for a VCP button
PLC programming video series..is here.
https://www.youtube.com/playlist?list=P ... i2WKIedQlQ
https://www.youtube.com/playlist?list=P ... i2WKIedQlQ
Need support? READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
-
- Posts: 58
- Joined: Mon Apr 22, 2019 11:22 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: none
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
Re: Coding for a VCP button
Hi Keith
You mentioned there would be a version soon that supported changing images of the VCP buttons in an easier manner than present.
Is there an eta for that update ?
You mentioned there would be a version soon that supported changing images of the VCP buttons in an easier manner than present.
Is there an eta for that update ?
-
- Posts: 127
- Joined: Wed Jul 10, 2019 9:24 am
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: none
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
Re: Coding for a VCP button
Is changing the images part of the new Beta release?
Thanks!
Thanks!
FlyingHaggis wrote: ↑Wed Nov 20, 2019 1:34 pm Hi Keith
You mentioned there would be a version soon that supported changing images of the VCP buttons in an easier manner than present.
Is there an eta for that update ?
-
- Posts: 506
- Joined: Tue Aug 28, 2018 3:47 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: C8df84dfbdd5-0809181120
- DC3IOB: No
- CNC12: Yes
- CNC11: Yes
- CPU10 or CPU7: No
- Contact:
Re: Coding for a VCP button
Nobriuz wrote: ↑Mon Nov 25, 2019 1:18 am Is changing the images part of the new Beta release?
Thanks!
FlyingHaggis wrote: ↑Wed Nov 20, 2019 1:34 pm Hi Keith
You mentioned there would be a version soon that supported changing images of the VCP buttons in an easier manner than present.
Is there an eta for that update ?