CL Varible Assignment Not Retaining Value

04 Jun 2021 04:16 #211125 by jlennox
Hi Guys,

I am having some trouble getting my oiler classic ladder circuitry to work correctly. I have attached a photo of my CL circuit.

Aim: To trigger the oil pump for 10 seconds after every 45 minutes of machine movement. The time on motion must be retained between sessions for consistent oiling.

Explaination: While the machine is in motion (MOVING), the Timer (%TM2) is triggered and times for 1 second. Each time the timer counts it does one of 2 things, it triggers the up pin on the counter and assigns the new counter value to the %W0 variable. The counter (%C0) will count for 2700 seconds (45 minutes) when it will trigger the done output and reset the counter. When the counters done pin rises, it triggers the timer (%TM3) which will turn on my oil pump (OILER) for 10 seconds.

Problem: The circuit itself works as intended and %W0 is updated with the Counter value (%C0.V) as seen in the variables window, however, the Variable Assigment (%W0) is not assigning the counter value (%C0.V) to last assigned value in the previous LCNC session upon start up. It appears to me as if the variable %W0 is not being stored in the internal memory between sessions as per the LCNC documetions for Variable Assingments.

When you assign a value to a variable with the variable assignment block the value is retained until you assign a new value using the
variable assignment block. The last value assigned will be restored when LinuxCNC is started. "

Hypothesies: Perhaps I am misunderstanding the LCNC documention and I need to export and import the Counter Value and store it in the variables .var file using %IWxxx and %QWxxx? Or have i just run into a bug with my installation. It would be appreciated if you classic ladder wizards could shed some light.

Please Log in or Create an account to join the conversation.

04 Jun 2021 05:01 #211127 by cmorley
Variable values are not recorded at shutdown - I am not sure what the docs were getting at.

Please Log in or Create an account to join the conversation.

04 Jun 2021 21:52 #211177 by BigJohnT
Probably trying to say in an assignment block the number in there is saved until you change it... dunno who wrote that note... at least I hope it wasn't me.

You would need to store the value in a variable that is 30-5000 and in your .var file.

You can read HAL pins in G code and save that number to a variable, then reverse at the start of your g code to set the counter.


Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum