Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: msholden on September 06, 2009, 11:10:41 AM
-
Hi,
I am writing an Cypress Enable Scripting application inside of Mach3 programming environment.
Have set up a user defined LED to sense a Halleffects transducer and used input#1 in the Mach-3 to indicate one pulse per revolution. While in an loop I will count the revolutions and accumulate. Does anyone know how to see input#1 in VB?
Does any one know of a way to trap (Esc) Key when pushed (chr$(27)) while in a loop in VB
Can not find an equivalent for Inkey which is an old way to trap key strokes. Any ideas?
Thanks to all.
-
create a button that triggers an led, then assign a hotkey to that button whenthe led triggers it can break the loop.
BE warned that the esc key is NOT a good key to use as it has other functions in mach that are hardcoded in. I would PICK another key (;-)
Just a thought, (;-) TP
-
for example, you can have a UserDRO be your counting storage place, or a param. You can put this in the Macropump without a while statement
since it loops automatically for you. If you want it in a stand alone macro, then put the while in it.
'when LED 2000 is ON, it does not count (you can control the LED2000 via brains, a screen button, or hotkey).
''when LED 2000 is OFF, it does NOT count, and it resets your counter to "0"
counter = GetUserDRO(1500)
If Not GetUserLED(2000) then
If IsActive(INPUT1) then
counter = (counter + 1)
SetUserDRO(1500, counter)
'your code here........................
End If
End If
If GetUserLED(2000) then
SetUserDRO(1500, 0)
'your code here........................
End If
'scott
-
How fast a count do you expect to make? Your VB code will only get to run 10 times per second, so I would not expect to accurately count any pulse of more than a couple per second.
A brain might be a better way to count, then use the VB to handle the logic of the count values.
-
Ron,
The required RPM needed 300 to 600. I need to find another way to program the coil winder.
Thanks
-
VMax549 and Scott,
I am new to Mach 3 but work with QB-6 and 2007. I will not use the Esc key for any input or trapping. The response time of the Macropump is not frequent enough to count the required RPM, I thought the Hallefects transistor was slow. I did not know about the macropump and have many uses for it but will check out the specifications first. I have received great help and quick response from all.
THANKS!