cadcoke5 Posted February 27, 2014 Share Posted February 27, 2014 I am debugging some routines. When I ? a private variable to the command window, it show a value. Note that the ? is just before I put an endless loop to keep the sequence running But, when I put the variable it the watch window, it only shows as "C100 Channel or function not found." Note that the sequence is continuing to run during this time. Any ideas what is happening? I thought watch windows should show the private variables in a running sequence? -Joe Link to comment Share on other sites More sharing options...
AzeoTech Posted February 27, 2014 Share Posted February 27, 2014 The watch only displays globally visible variables and privates from a sequence that is currently being stepped through (i.e. has hit a breakpoint). It does not show the contents of privates in running sequences, only the one sequence that is being debugged, if any. That would be a problem if, for example, you had two sequences running that had the same private variable names. Link to comment Share on other sites More sharing options...
cadcoke5 Posted March 10, 2014 Author Share Posted March 10, 2014 Sorry if I am being dense. I am still not getting the approach to variables in DAQFactory. Note that I do have some past programming experience with VBA. Somewhere on this forum I came across a message that said that all variables in DAQFactory are arrays. So, they are not declared to be arrays when they are first declared. But, for some reason the following code does not work for me. private TestVar TestVar[0] = 99 while(1) endwhile Note that I expect to later add more items to the TestVar array. But, apparently the line "TestVar[0] is not correct. Thank you for answering this simple question, -Joe Link to comment Share on other sites More sharing options...
AzeoTech Posted March 10, 2014 Share Posted March 10, 2014 There is nothing wrong with that line. The problem is lines 5 and 6, which are an infinite loop with nothing in it, which will just freeze the sequence, and depending on your computer, DAQFactory as well. Also, if you want to use a variable as a scalar, don't use any subsetting: private TestVar testVar = 99 Link to comment Share on other sites More sharing options...
cadcoke5 Posted March 10, 2014 Author Share Posted March 10, 2014 I put the infinite loop there to keep the watch variables active. Then, set the routine to a low priority, so it doesn't eat up all the processor time. When I run the code, a watch of TestVar says "C1000 Channel or function not found". -Joe Link to comment Share on other sites More sharing options...
AzeoTech Posted March 10, 2014 Share Posted March 10, 2014 Watch variables won't pick up a private variable unless the sequence is being actively debugged. Just running it doesn't mean you are debugging it. You'd have to put a break point in and walk through the code. Just add: ? testVar at the end and get rid of the while() and you'll see 99 appear in the command/alert window Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.