Where are non volatile values?

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
Toaster
Posts: 198
Joined: Mon Oct 29, 2018 5:25 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Where are non volatile values?

Post by Toaster »

I've been doing some macro programming lately and I've been using the non volatile user value storage (150-159)

Is there a way I can see (and alter) those in the PARMS list in CNC12?

While they are useful, I feel like when I use them I'm putting the values into a black box and I'd like to be able to check that they're being stored the right way....
swissi
Posts: 573
Joined: Wed Aug 29, 2018 11:15 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 985DADEB24D5-0309180716
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: Where are non volatile values?

Post by swissi »

Toaster wrote: Thu Jan 14, 2021 7:37 pm I've been doing some macro programming lately and I've been using the non volatile user value storage (150-159)

Is there a way I can see (and alter) those in the PARMS list in CNC12?

While they are useful, I feel like when I use them I'm putting the values into a black box and I'd like to be able to check that they're being stored the right way....
They are stored in the file job.xml in the c:\cncm folder under index'0"=#150 to index="9"=#159

-swissi
If you are using Fusion 360, check out my CNC12 specific Post Processor
If you are using a Touch Probe, Tool Touch Off Device or a Triple Corner Finder Plate, check out my ProbeApp

Contact me at swissi2000@gmail.com
Toaster
Posts: 198
Joined: Mon Oct 29, 2018 5:25 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: Where are non volatile values?

Post by Toaster »

Ahh! There they are!

Thanks!
Toaster
Posts: 198
Joined: Mon Oct 29, 2018 5:25 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: Where are non volatile values?

Post by Toaster »

So follow up to this one:

I want to make a VCP button with an LED light on it that will turn on/off based on a non volatile user value. Do I have to reference a PLC number to find turn the lights on and off? I feel like I tried using #150 #151 etc and it didn't work..
cncsnw
Posts: 3832
Joined: Wed Mar 24, 2010 5:48 pm

Re: Where are non volatile values?

Post by cncsnw »

Yes, that would have to come from -- or at least through -- the PLC program.

In general, if you want a button to turn on/off a state, which persists from job to job and from day to day, it will work best to do it entirely in the PLC program.

SV_NV_W1 through SV_NV_W10 are PLC variables ("word" variables, which are 32-bit integers) that are automatically saved in non-volatile memory on the control board. You can write PLC logic to store the state of your "LED" in SV_NV_W1, for example; and to read that variable in InitialStage to set the state of the LED on startup.
Toaster
Posts: 198
Joined: Mon Oct 29, 2018 5:25 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC11: No
CPU10 or CPU7: No

Re: Where are non volatile values?

Post by Toaster »

Ok, that makes sense. What numbers would I reference to find those values?
cncsnw
Posts: 3832
Joined: Wed Mar 24, 2010 5:48 pm

Re: Where are non volatile values?

Post by cncsnw »

The non-volatile word variables in the PLC language are "SV_NV_W1" through "SV_NV_W10". You can give alternate names for them in your PLC source with an "IS" statement, but I generally do not. They are few, and their purpose is more clear if I use the native/internal name.

If by "numbers", you mean what CNC system variables (akin to "#101" or "#150") you use to retrieve them, they are not mapped into CNC system variables. If you somehow needed to access a SV_NV_Wn value in a CNC program, you would need to have the PLC copy it into a regular word variable (something between W1 and W44) so you could read it with #960nn.
cncsnw
Posts: 3832
Joined: Wed Mar 24, 2010 5:48 pm

Re: Where are non volatile values?

Post by cncsnw »

Suppose you want to use Aux3 as a roll-your-own Optional Stops control, which can be switched during a program run. Suppose further that you want its on-or-off selection to persist through a power cycle.

Among your definitions you would have things like:

Code: Select all

Aux3Key                       IS INP1061  ; Row  1 Column 5
Aux3LED                       IS OUT1061; Row  1 Column 5
OptionalStops_M               IS MEM32 ; 1 = Stop and wait at M1  0 = don't wait  (M1 macro depends on this location)
KbAux3Key_M                   IS MEM421 ; "ctrl" + "F3"
Aux3Key_M                     IS MEM453 ; Aux3 keypress, from any source
SkinAux3_M                    IS SV_SKIN_EVENT_5  ; Row  1 Column 5
Aux3PD                        IS PD43
In InitialStage you would have something like:

Code: Select all

IF SV_NV_W1 == 1 THEN SET OptionalStops_M
You don't need to test the opposite condition, because when InitialStage runs, all memory bits are still zero.

In MainStage you would have something like:

Code: Select all

; Combine Aux key presses from jog panel, keyboard and VCP into a single location
IF Aux3Key || KbAux3Key_M || SkinAux3_M THEN (Aux3Key_M)

; Detect when the key was just pressed (rising edge)
IF Aux3Key_M THEN (Aux3PD)

; Use keypress event to toggle OptionalStops_M on and off,
; and also display the status on the Aux LED.
IF OptionalStops_M ^ Aux3PD THEN (OptionalStops_M), (Aux3LED)

; Update SV_NV_W1 with current selection, so that it is restored properly on the next power-up
IF OptionalStops_M THEN SV_NV_W1 = 1
IF !OptionalStops_M THEN SV_NV_W1 = 0
And finally, in the CNC macro mfunc1.mac:

Code: Select all

; M1 - Optional Stop and Wait for Operator
IF [#70032] THEN M0   ; stop and wait only if MEM32 is set
Post Reply