Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : Stepper Project

   Page 6 of 6    
Posted: 08:19am
04 May 2026
Copy link to clipboard
phil99
Guru


[32] Select Case click(ref)
Error : REF is not declared

As you are using OPTION EXPLICIT it thinks REF is an undeclared variable.
Have you set OPTION GUI CONTROLS xx ? Without that advanced controls won't work properly.
It should appear in OPTION LIST.

See the first page of PicoMite Advanced Graphics manual.
Edited 2026-05-04 18:19 by phil99
 
Posted: 08:21am
04 May 2026
Copy link to clipboard
Bryan1
Guru


Yep I'm on now reading that Advanced Graphics again and couldn't see the wood from the trees today,  

Been reading up on the MsgBox() and I'm thinking as we can open a file this could open G-Code and by setting $values on the axis setup pages they could then be used for the stepper gc $'s.

I still have a long way to go getting it all the pages setup and it is nice to have a break from fabrication.

Edit: I was typing and missed your post Phill and yes I did set the GUI Controls to 75 before I started.
Edited 2026-05-04 18:23 by Bryan1
 
Posted: 09:04am
04 May 2026
Copy link to clipboard
matherp
Guru

Lyle
Please could you test B5 to make sure I haven't broken anything. B5 now supports a 4th axis (A)
 
Posted: 09:15am
04 May 2026
Copy link to clipboard
Bryan1
Guru


Peter I'm running B4 and I may get enough dutch courage tomorrow with this gui and have a go at running the stepper. Now when I was using it yesterday I did notice a couple of times it kept going the error of no soft limits and only a reset stopped it. Now the code for the soft limits never changed in the code so not sure.

In the morning I can try it again and see if it happens again then take some screen shots.
 
Posted: 12:59pm
04 May 2026
Copy link to clipboard
mozzie
Senior Member

G'day Peter,
Will load it up in the morning and report back, thanks for the additional A axis  

I do wonder if you can read minds, I was planning a rotary engraving machine but was going to re-assign the Y-axis as the rotary. A call from my nephew with an idea for a project has moved it up the to-do list.

So many projects and only 2 hands...

Regards,
Lyle.
 
Posted: 07:22pm
04 May 2026
Copy link to clipboard
PhenixRising
Guru

Just a bit curious re: no A axis homing.

There are rotary tables with limited rotation and also, not every workpiece is circular.
 
Posted: 02:35am
05 May 2026
Copy link to clipboard
Bryan1
Guru


Ok next bit of fun   Working off the Advanced Graphics Manual example got the radio button working but it just goes to a blank screen. now I have stripped back all the const's that weren't being used and made sure like the manual states the GUI button needs to be a higher #number and the new GUI area a lower # number.

I did change from the radio button to using the GUI LED

Now this code is a copy of whats in the manual and it still keeps going to a blank screen when either of the LED's are touched with the stylus

OPTION EXPLICIT
OPTION DEFAULT NONE
option console serial
Colour RGB(white), rgb (black)
const X_position = 1, xsetup = 2, Y_position = 7, ysetup = 3, zsetup = 4
const Z_position = 5  
'const    
'Const  
const  X1 = 20, Y1 = 21, Z1 = 22
'const
const  PAGE_1TITLE = 29, Z0 = 30
const  ver = 32, X0 = 33
const  Y0 = 34
cls
backlight 50

font 1,2 : gui caption PAGE_1TITLE, "MMBasic Surface Grinder", 70, 20 '29
           gui caption ver, " Version 0.001", 100, 40
GUI led X1,"X Axis", 350, 160, 10, rgb(red) '#20
gui led Y1,"Y Axis", 350, 210, 10, rgb(red) '#21
gui led Z1,"Z Axis", 350, 260, 10, rgb(red) '#22
gui displaybox X_position, 60, 90, 140, 30, rgb(white) '#1
ctrlval(1) = "0.000"'Str$(Peek(stepper x),-4,4)
gui button X0,"X",0,80,50,50, rgb(white)               '#33
gui displaybox Y_position, 60, 130, 140,30, rgb(white) '#7
ctrlval(7) = "0.000" ' Str$(Peek(stepper y),-4,4)
gui button Y0, "Y", 0,120,50,50, rgb(white)            '#34
gui displaybox Z_position, 60, 170, 140, 30, rgb(white) '#5
ctrlval(5) = "0.000" ' Str$(Peek(stepper z),-4,4))
gui button Z0, "Z", 0, 160, 50, 50, rgb(white)          '#30
gui page 1, 2, 3, 4
gui interrupt TOUCHDOWN

do
loop

sub TOUCHDOWN

if touch(ref) = 20 then GUI page 2 'X1 #20

if touch(ref) = 21 then gui page 3 'Y1 #21

if touch(ref) = 22 then gui page 4 'Z1 #22

 end sub
 
 gui setup 2
 
 gui caption xsetup,"X Axis Config", 60, 20, rgb(green) '#2
 
 Gui setup 3
 
 Gui caption ysetup,"Y Axis Config", 60, 20, rgb(green) '#3
 
 gui setup 4
 
 gui caption zsetup,"Z Axis Config", 60, 20, rgb(green) '#4


It has me beat why this isn't working
Edited 2026-05-05 16:53 by Bryan1
 
Posted: 04:48pm
05 May 2026
Copy link to clipboard
mozzie
Senior Member

G'day,
Sadly no time for testing today, hopefully better luck tomorrow.

Bryan, you had it so close but not quite, the GUI SETUP needs to be before the DO:LOOP or it will won't be executed:
Option EXPLICIT
Option DEFAULT NONE
Option console serial
Colour RGB(white), RGB(black)
Const X_position = 1, xsetup = 2, Y_position = 7, ysetup = 3, zsetup = 4
Const Z_position = 5
Const  X1 = 20, Y1 = 21, Z1 = 22
Const  PAGE_1TITLE = 29, Z0 = 30
Const  ver = 32, X0 = 33
Const  Y0 = 34
CLS

Font 1,2
GUI caption PAGE_1TITLE, "MMBasic Surface Grinder", 70, 20 '29
GUI caption ver, " Version 0.001", 100, 40
GUI led X1,"X Axis", 350, 160, 10, RGB(red) '#20
GUI led Y1,"Y Axis", 350, 210, 10, RGB(red) '#21
GUI led Z1,"Z Axis", 350, 260, 10, RGB(red) '#22
GUI displaybox X_position, 60, 90, 140, 30, RGB(white) '#1
CtrlVal(1) = "0.000"'Str$(Peek(stepper x),-4,4)
GUI button X0,"X",0,80,50,50, RGB(white)               '#33
GUI displaybox Y_position, 60, 130, 140,30, RGB(white) '#7
CtrlVal(7) = "0.000" ' Str$(Peek(stepper y),-4,4)
GUI button Y0, "Y", 0,120,50,50, RGB(white)            '#34
GUI displaybox Z_position, 60, 170, 140, 30, RGB(white) '#5
CtrlVal(5) = "0.000" ' Str$(Peek(stepper z),-4,4))
GUI button Z0, "Z", 0, 160, 50, 50, RGB(white)          '#30

GUI setup 2
 GUI caption xsetup,"X Axis Config",60,20,,RGB(green) '#2

GUI setup 3
 GUI caption ysetup,"Y Axis Config",60,20,,RGB(green) '#3

GUI setup 4
 GUI caption zsetup,"Z Axis Config",60,20,,RGB(green) '#4

GUI Setup 5
 GUI Button 6,"MAIN",400,0,75,30,RGB(black),RGB(red)

GUI page 1

GUI interrupt TOUCHDOWN

Do :Pause 100:Loop Until Inkey$<>""

End

Sub TOUCHDOWN
 If Touch(ref) = 20 Then GUI page 2,5 'X1 #20
 If Touch(ref) = 21 Then GUI page 3,5 'Y1 #21
 If Touch(ref) = 22 Then GUI page 4,5 'Z1 #22
 If Touch(ref) = 6 Then GUI page 1
End Sub

GUI PAGE 5 adds a button "MAIN" so you can get back to page 1

Now I'm off to bed...zzzzzzzz

Regards, Lyle.
Edited 2026-05-06 03:17 by mozzie
 
Posted: 06:35am
06 May 2026
Copy link to clipboard
Bryan1
Guru


Many Thanks for finding that problem for me Lyle   Well I'm now on 116 lines of code and as I used the const number where I had it all working I decided to change it over to each const name and still going thru all the error's that are popping up like where the #number worked now I'm getting this

[62] GUI caption Ycap,"Enter Y Length", 20, 125, RGB(green)     '#37
Error : Expected a string


The code is now upto

Upload completed 1

Saved 4107 bytes
>
Time taken: 188362mS


So it taking around 3 minutes to load the code and I did find putting a extra comma got rid of the error

gui caption Ycap,"Enter Y Length", 20, 125,, rgb(green)


So getting there guy's and by the end of today when I get the code to work I will upload the code so you guy's can try it out  

Still got code in the stepper interface and the way it is looking Peter's big board may be used as all the in/outs will exceed the 2350A chip.

So on each Axis page the global postion is shown and a number box is there for input, also on each page is toggle switch's which are needed so we can move each Axis into position before the job is started.

With page 5 that Lyle made I have the 6 led's needed for the limits and the E-Stop so it can be seen on each of the Axis pages and be a global page for each extra page made.

Now to get this code working I do think we need to get the toggle buttons on each axis working so we can setup movement on the steppers then we may just get over Version 0.001  

Pretty soon I will get this code to work and it I think it has been a successful day getting this far.

Regards Bryan
 
Posted: 06:50am
06 May 2026
Copy link to clipboard
Bryan1
Guru


Ok guy's here my days work  


gui surface grinder.zip

I do think it is time we cameup with a pin assignment so the stepper code can be inserted and Lyle hopefully you can have a play tonight with it.

Regards Bryan
 
   Page 6 of 6    


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026