<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META content="MSHTML 6.00.2713.1100" name=GENERATOR><STYLE></STYLE></HEAD><BODY bgColor=#ffffff><DIV><FONT face=Arial color=#0000ff size=2><SPAN class=444460520-29082003>I use events to read analog inputs from an acquisition card (Keithley KPCI-3108). I use ActiveX to setup the card and a event handler function to transfer the data into the desired variables. I am not shure this is what you are looking for, but it could be good enought to help you.</SPAN></FONT></DIV><DIV><FONT face=Arial color=#0000ff size=2><SPAN class=444460520-29082003></SPAN></FONT> </DIV><DIV><FONT face=Arial color=#0000ff size=2><SPAN class=444460520-29082003>First, you need to create an ActiveX control (see the Device menu). From that control object, you right-click on the title bar to create an Event handler, then you select the event to handle. This will create a function that will be called when the selected event happens. In this function, you put what you need to complete the event with the rest of the program (for example, you can interface with applicable hardware, then set a flag before leaving the function to tell your main loop that it's ready). This event handler function is not called by the VEE program, but by the driver associated with your equipment.</SPAN></FONT></DIV><DIV><FONT face=Arial color=#0000ff size=2><SPAN class=444460520-29082003></SPAN></FONT> </DIV><DIV><FONT face=Arial color=#0000ff size=2><SPAN class=444460520-29082003>Hope this helps...</SPAN></FONT></DIV><BLOCKQUOTE> <DIV><FONT face="Times New Roman" size=2>-----Message d'origine-----<BR><B>De:</B> Zafer SAVAS [mailto:zsavas@mst.aselsan.com.tr]<BR><B>Date:</B> 29 aot 2003 05:04<BR><BR></FONT></DIV> <DIV><FONT face=Arial size=2>Is there anybody who tried to make event driven programs in vee?<BR>What i am trying to have is a vee program which makes a continuous measurement (such as an spectrum analyzer sweep action), but the execution control of the program (stop,warnings etc.) will be provided by the command strings which are sent to platform of the program over TCP socket, (I have the ActiveX UDP version but still not satisfied with it.)<BR></DIV></FONT> <DIV><FONT face=Arial size=2>I dont wanna use "To/From socket" object and dont wanna spent so much time for checking it. <BR>My program will surely be event driven such that events on DATA ARRIVALS to socket will direct the execution flow.<BR></FONT></DIV> <DIV><FONT face=Arial size=2>I know, it is possible but i couldnt be able to stop the execution with the event driven functions in my program however i succeded pop-up warnings.Somebody may say: "set a varible and check it in the main loop", i tried it, it is OK but still dont wanna spent extra time for variable checking.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Your comments are welcome!!!</FONT></DIV></BLOCKQUOTE>---<BR>You are currently subscribed to vrf as: rsb@soco.agilent.com<BR>To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".<BR>To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".<BR>To send messages to this mailing list, email "vrf@it.lists.it.agilent.com". <BR>If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".</BODY></HTML>
No problem!
> (I have the ActiveX UDP version but still not satisfied with it.)
Try SocketWrench (url courtesy of Paul de Tarso) :
www.catalyst.com/products/sockettools/socketwrench/index.html
> Somebody may say: "set a varible and check it in the main loop",
> i tried it, it is OK but still dont wanna spent extra time for
> variable checking.
Somebody is right: that's the *only* way you'll be able to get this done in
VEE, or any other programming language for that matter. Well, not the *only*
way. In a multithreaded environment you could start a thread dedicated to
measuring and storing and then kill the thread when you receive a Stop
command via TCP, but you'd have to write a dll to do it and it's bad
programming practice. Any thread should always check a continue/terminate
variable and either return naturally or call the ExitThread API. The
TerminateThread API should only be used in the most extreme circumstances.
It doesn't take long to check the state of a variable:
MeasureLoop()
Until Break
If NOT gbStop Then
Measure
Store
Else
Break
End If
Loop
End Function
Socket_OnReceive()
gbStop = True
End Function
If this minimal MeasureLoop isn't fast enough you'll have to use a compiled
function to implement it, and things get more complicated. Using a separate
thread is the only way to keep both the measurement and VEE going at the
"same time". Note that there's no mutually exclusive access guard on gbStop,
but in the minimal scenario OnReceive is guaranteed to execute fully in any
VEE timeslice and it's not necessary.
In the faster compiled function scenario, VEE can still host the Automation
Library and the OnReceive event, but since there will be two separate Win32
threads accessing one shared variable, mutual access exclusion is a must.
Addressing the variable with VEE also becomes something of an issue: if it's
defined in VEE, then the measurement thread can't get at it. If it's defined
in the dll then VEE needs an access function to get at it or it's address
has to be exported from the dll.
It *should* be possible to define it in VEE and pass a pointer to it to the
dll so the dll could see it change in VEE by dereferencing the pointer, but
I wouldn't count on that unless somebody from Agilent explicitly says VEE
will work this way. Besides, you'd have to use a Critical Section or
Interlocked operation in the dll for access to the variable to guarantee VEE
wouldn't try to access it at the same time and that's just plain kludgy.
-SHAWN-
---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@it.lists.it.agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".