06-09-2014 03:31 AM
Hi,
I have a problem when running some of my VI's without opening the block diagram. As I open the VI, only the front panel pops up (as it should be?), and when it is run I get an "Access violation (0xC0000005)". However, when I open the VI and then also choose "Block diagram" under "Window " in the toolbar, I don't get any problem at all. Does anyone know what difference is when running av VI without Block diagram being open? Would be very grateful for any help since this issue occurs at several VI's.
06-09-2014 06:12 AM
Hi Mersad,
This is not typical behavior, but I can't say more unless you provide more information. Please describe your VI in more deail. What version of LabVIEW are you using? What does your VI do?
If possible, post a copy of the VI.
06-09-2014 08:06 AM
Hi,
I suspected someone would ask for that, so I'll post it below, but my intention was to ask a general question regarding the difference of running with Block diagram and/or with probes. The copy of the VI is from a subVI which I am using to read from a digital input channel. I might have solved the problem by adding a 10ms wait (as can be seen in the middle of the pic), but I am not completely sure of why it works. It seems like there might be a small delay of initiating the digital input channel which leads to the "Access violation", 10ms delay before reading seems to be enough, but how can I be sure that it will always be enough? I tried to search for similar problems at the forum and I read at one place that there might be a race problem for similar applications, so that's why I added the "Wait".
Is this safe? Is there a better way of making sure that the channel is ready to be read?
06-09-2014 08:08 AM
I forgot to add that I'm running LabView on a PC with Windows 7 along with PXI-1044.
06-09-2014 08:19 AM
I'm suspecting that Reset Device might need the wait before you can actually read from it. A lot is happening when you reset a device. I also don't see a need for the Start DAQmx Task since you are defaulting to a single shot sample. You just need the DAQmx Read and it will do the Start->Read->Stop for you.
06-09-2014 08:22 AM - edited 06-09-2014 08:24 AM
You have a couple of questionable structures there. An Action Engine (Ben's famous Action Engine Nugget is always a good read. http://forums.ni.com/t5/LabVIEW/Community-Nugget-4-08-2007-Action-Engines/m-p/503801) Is uasually a Case inside a single itteration while loop with a Shift register to store private data (optionally a Feedback node can act as the AE Private Data stroage mechanism) inside a error/no error case . Your outer While loop makes no sense and adds nothing to the functionallity.
Whith a N chan Single sample on demand DAQmx Task I would not use the Start Task inside the configuration case. Use Control Task instead and chose "Commit" The task will "Autostart" when the Read is called. Using the Start Task in this location involves an implicit state transition that is undesireable since every read now needs to complete by transition all the way back to the state befor the implied transition ( Verified). See Here for further explaination
@ Tim Reset device returns when reset is complete or timeout error
06-09-2014 10:11 AM
Thanks! I will try swapping Start task to Control task with Commit. Agree that the outer while loop is useless, will delete it. I didn't get the link to Ben's famous Action Engine Nugget to work, can you maybe repost it?
06-09-2014 10:28 AM
There was an unneeded parenthesis at the end of Jeff's link that was causing a problem.
06-10-2014 01:59 AM
Hi again,
I tried to swap Start task with Control task, but I still got the "Access violation"-message. This actually comes on of the two computers I'm working on, the other one didn't have this problem after I added the 10ms wait earlier.
06-10-2014 03:44 AM
Hi Mersad,
I cannot find any documentation regarding your original question (difference when running a VI without block diagram being open), so I would say no, there should not be any difference as long as you do not use any block diagram feature that slows down/halts the code execution itself, such as execution highlighting or breakpoints.
You say that you experience this problem on two computers? But on one of them, it helped by adding a 10 ms wait? What version of LabVIEW and DAQmx do you use?
You report "Access violation (0xC0000005)", but this is a rather general error. Do you get any more text/info together with the access violation?