Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 07:42:25 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Key Trapping Inside Cypress Enable Scripting
Pages: 1   Go Down
Print
Author Topic: Key Trapping Inside Cypress Enable Scripting  (Read 1207 times)
0 Members and 1 Guest are viewing this topic.
msholden
Active Member

Offline Offline

Posts: 6


View Profile WWW
« on: September 06, 2009, 10: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, 10:16:59 AM by msholden » Logged
vmax549
Guest
« Reply #1 on: September 06, 2009, 03: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, 03:34:17 PM by vmax549 » Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #2 on: September 07, 2009, 09: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
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Ron Ginger
V4 Screen Contributor

Offline Offline

Posts: 568



View Profile WWW
« Reply #3 on: September 11, 2009, 05: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.
Logged
msholden
Active Member

Offline Offline

Posts: 6


View Profile WWW
« Reply #4 on: September 15, 2009, 10:21:38 AM »

Ron,
The required RPM needed 300 to 600.  I need to find another way to program the coil winder.
Thanks
Logged
msholden
Active Member

Offline Offline

Posts: 6


View Profile WWW
« Reply #5 on: September 15, 2009, 10: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!
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!