Hello Guest it is April 23, 2024, 05:58:38 AM

Author Topic: Key Trapping Inside Cypress Enable Scripting  (Read 6323 times)

0 Members and 1 Guest are viewing this topic.

Key Trapping Inside Cypress Enable Scripting
« 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.
« Last Edit: September 06, 2009, 11:16:59 AM by msholden »

vmax549

*
Re: Key Trapping Inside Cypress Enable Scripting
« Reply #1 on: September 06, 2009, 04:28:34 PM »
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
« Last Edit: September 06, 2009, 04:34:17 PM by vmax549 »

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Key Trapping Inside Cypress Enable Scripting
« Reply #2 on: September 07, 2009, 10:23:35 AM »
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
fun times
Re: Key Trapping Inside Cypress Enable Scripting
« Reply #3 on: September 11, 2009, 06:17:56 PM »
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.
Re: Key Trapping Inside Cypress Enable Scripting
« Reply #4 on: September 15, 2009, 11:21:38 AM »
Ron,
The required RPM needed 300 to 600.  I need to find another way to program the coil winder.
Thanks
Re: Key Trapping Inside Cypress Enable Scripting
« Reply #5 on: September 15, 2009, 11:32:58 AM »
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!