Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: davidimurray on June 05, 2006, 05:10:05 PM
-
Hi
I'm writing a wizard to assist in calibrating the spindle. What I want to do is this :-
1) Have a 'start calibration' button that contains the main code
2) When you click this, the spindle starts and the spindle speed is incremented by an amount previously chosen by the user.
3) The user then measures the speed and enters it into a DRO.
4) The user then clicks a 'Next' button which stores the two values in an array, and then increments the spindle speed again
5) The procedure continues as above until the max speed is reached.
I've got some of it working. But I don't know how to implement the 'Next' button - any ideas greatly appreciated !
Cheers
Dave
-
The best way to do this in Mach3 is to have each Inc take you to a new screen... OR you can do it on the same screen with a counter running in the background. You could then do Counter * inc = Speed Call SetOEMDRO(1200.Speed) Something like that should work...
-
Hi Brian
I've got the speed increment working - but I'm not quite sure where is the best place to put the code. Two theories :-
1) Have a 'start' button which initiates everything then the actual increment button writes the values to a 2d array. Each time I click the button will the array remain there? Oh and so far I can only get 1d arrays to work!
2) Have a start button that contains all the code and while loops looking for a button condition - I've tried this and can't get it to work.
The idea I'm working on is to interpolate points between those entered by the user to create enough to allow linearity.dat to be written to and produce a series of straight lines between known points. By allowing the user to enter the value there is no need to have a spindlex index sensor as I would never need one on the mill for what I do.
Cheers
Dave
-
I have not setup any array's in VB :( I can tell you how to do it in C++.. I will have a look at the house and see what I have for code that I can give you ;)
-
Brian
I may have an alternative, allthough cheating, method. Simply append each entry to a text file and then re-read it later. I've got the text file creation working, now I just need to spend some time reading it back in - that will have to wait until my next coffee break at work!
Cheers
Dave
-
If you are going to do that write theit as a Ver in Mach3... This is how I did a 2X10 array:
For i=0 To 19 Step 2
Call setVar ((120 + i), GetUserDRO(1140 +i))
Call setVar ((121 + i), GetUserDRO(1141 +i))
Next
to read the array I did the following:
For i=1 To 10
onOff = Int( LEDonOff / ((10^ i)/10)) - Int( LEDonOff / ((10^(i+1))/10))*10
X = FormatNumber (GetVar(100 +((i-1)*2)),4)
Y = FormatNumber (GetVar(101 +((i-1)*2)),4)
If onOff = 1 Then
If Nc=0 Then
Call Drill_cycle(X,Y,Z,Q,R,F)
Else
Code " X" & X & " Y" & Y
End If
Nc=1
End If
Next
I did this so I could have a gobal variable... I also used a register to save the led's states and that tells the loop if the point is used... I know it is not how you would do it if you were doing real VB but it works!
-
Ah ha
Strangely, doing it that way had crossed my mind but I decided not to go down that route - haven't got a clue why!
The only potential issue is how many user variables are there available ? I imagine that other users with a greater spindle speed range may want to use a large numbered of measured speeds. My spindle only goes from 0-2200 in high gear!
Cheers
Dave
-
You have from 0-1999 that you can use if you need to :)