Thang Nguyen Posted June 26, 2008 Report Share Posted June 26, 2008 Hi, I am working on a project which require to use an activeX module to communicate with another system. When I intialize the communication, sometime it got hang, sometime it's not. I try to use the delay module, but it didn't help. I would like to know how to implement a timeout module or watchdog so I can jumpout of the subVI. I intend to use this module (picture is attached) inside the subVI dealling with initialize the activeX module, but it stop the whole program. Do you have any suggestion? Thank you, Thang Quote Link to comment
Thang Nguyen Posted June 26, 2008 Author Report Share Posted June 26, 2008 Hi, After I try the code in the picture, it still cannot help. The PC got hang means nothing run anymore. If I turn on the hightlight to track, everything runs fine. But I don't turn on the hightlight, the PC got hang. Do you have any recommendation? Quote Link to comment
Ton Plomp Posted June 26, 2008 Report Share Posted June 26, 2008 Don't use the 'stop function' QUOTE (Thang Nguyen @ Jun 25 2008, 09:05 PM) Hi,After I try the code in the picture, it still cannot help. The PC got hang means nothing run anymore. If I turn on the hightlight to track, everything runs fine. But I don't turn on the hightlight, the PC got hang. Do you have any recommendation? Your while loop waits for the 'Create ActiveX Ref VI', so the abort will not happen. Is that the same VI you openend dynamically? If so try the following structure: http://lavag.org/old_files/monthly_06_2008/post-2399-1214422483.png' target="_blank"> Ton Quote Link to comment
bmoyer Posted June 26, 2008 Report Share Posted June 26, 2008 Try using a sequence structure with 2 frames. Initialize in the first frame, and then put a Wait (ms) function in the 2nd frame to have the code wait for a certain amount of time after initializing. ActiveX and dll calls are sometimes very difficult to work with because they'll freeze up your entire program if the ActiveX or dll themselves are buggy (because they run in the User Interface thread). Bruce Quote Link to comment
Thang Nguyen Posted June 26, 2008 Author Report Share Posted June 26, 2008 @tcplomp: I am testing using your method. I also try with the property node return the state of the execute VI. QUOTE (bmoyer @ Jun 25 2008, 02:41 PM) Try using a sequence structure with 2 frames. Initialize in the first frame, and then put a Wait (ms) function in the 2nd frame to have the code wait for a certain amount of time after initializing.Bruce @Bruce: the PC will hang at the first frame. The 2nd frame has no chance to start. I am still testing it. Let you know when I got sth Quote Link to comment
alukindo Posted June 27, 2008 Report Share Posted June 27, 2008 Thang: I use quite a bit of ActiveX. I am curious as to what you are doing inside the initialize ActiveX subVI. E.g: Do you start a new instance of ActiveX ref as you initialize in the loop? Also, is your ActiveX an *.OCX or *.Dll file? Theses behave very differently. I think that you should try and re-solve the hanging rather than trying to find a way to bail-out if the initialize step hangs. May be able to help further if you show the inside of the initialize ActiveX SubVI. Anthony. Quote Link to comment
Thang Nguyen Posted June 27, 2008 Author Report Share Posted June 27, 2008 @Athony: You are right. My problem is, in the initialize ActiveX, I used a register event callback VI node. I tried to use the "initialize array" module to build an array of callback VI reference with only one callback VI reference. I have just tried to create seperate callback VIs and use the "build array" module to build the input reference for my callback register function. And it looks like the problem is solved. @Ton: your idea is really good. Even my first solution is wrong but when I use your methode, I can handle the hang situation. I also use the execution.state to track the sate of the VI. If it got hang the state will be "Bad". This is the first time I know how to use this property . Thank you guys. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.