Subprogram with variables not working

If you think you've found a bug post it here.

Subprogram with variables not working

Postby Ruslan » Sat Dec 09, 2023 8:29 pm

Hi, I just sterted to work with UCCNC(1.2115). I have a simple program with subroutine and variables that do spiral motion but it do not work corectly. It seems that subprogram doesn't know anyting about variables that I use in main program. I have another program similar to first but it works fine because it doesn't use vars in subprograms. I can't solve this problem. Maybe I don't know somethig important. Can anyone give me some info how to work with subprogram containing variables?
Many users say that they don't use hand coding, but I use it every days. I have retrofitted VMC and started to work with industrial cnc controller ADTech 4640 from China. It supports variables in subs and it is very stable system but it doesn't support probing, WCS rotation, mirroring and other useful features. So I decided to change it to UCCNC, but I am not happy because UCCNC has many bugs from version to version.
CILINDER_SPIRAL.NC
(346 Bytes) Downloaded 210 times
-- works fine in Cimco viewer but don't work in UCCNC
SPODPR1.NC
(251 Bytes) Downloaded 209 times
-- WORKS FINE IN Cimco viewer and in UCCNC
Ruslan
 
Posts: 28
Joined: Wed Jan 25, 2023 11:05 am

Re: Subprogram with variables not working

Postby cncdrive » Sat Dec 09, 2023 11:07 pm

UCCNC knows #variable values in sub progams just fine, the issue with your code is that UCCNC does not accept #var negations, so -# does not negate the value, but it makes UCCNC to not recognise the parameter value when the -# is after the axis word.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Subprogram with variables not working

Postby ian8555 » Tue Oct 01, 2024 7:40 pm

I am struggling to get variables and subroutines working when using G90, they work ok and as expected using G91 but not in G90. I am playing around with this code:

Code: Select all
#1 = 5
#2 = 5

G1 G90 Z0 F1000
M98 P1200 L10
M30

O1200
G91 G1 X#1
G1 Y50
#1 = [#1 *2]
M99


Any help please?
ian8555
 
Posts: 7
Joined: Tue Feb 22, 2022 1:38 pm

Re: Subprogram with variables not working

Postby Battwell » Wed Nov 06, 2024 8:38 pm

switch to g91 in your main program. before the subroutine
and back after the return to the main program.
dont switch in the subroutine
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 867
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk


Return to Report a bug

Who is online

Users browsing this forum: Google [Bot] and 4 guests