07-01-2015 12:12 PM - edited 07-01-2015 12:17 PM
Hello,
I'd like to start this by saying that I'm very new to LabVIEW so I apologize for any questions that should seem obvious. Also, when replying please remember I'm not as familiar as I would like to be with LabVIEW in general. I have recently had a problem put on my desk to add some functionality to a preexiting, fairly complex VI. The solution seems to be in scripting. However, loading a script longer than 55 lines gives an error (Is this normal? Is there a way around it?). The problem is pretty easy to break up into small parts, so the script has been broken up into multiple smaller parts that provide the same function when ran consecutively. After executing each script, the system will take some time to process (up to 300ms, IIRC) and will assert a ready bit when complete. Using that ready signal as a trigger, I would like to execute the next script.
The scripts are being read correctly into the program using "niHSDIO Write Script.vi", and can be selected by hard-coding the 'script name' into "niHSDIO Configure Script To Generate.vi". It will successfully execute any of the scripts when hard-coded, but when trying to call the next script (script names stored in an array, and incremented with a while loop) an error is given:
Error - 1074118651 occurred at niHSDIO Write Script.vi Possible reason(s): Driver Status: (Hex 0xBFFA4005) You cannot perform this action while the session is in the running state.
At this point, I've read quite a bit online and in the documentation about trying to find a way to suspend, pause, etc. the state to allow another script to load, but I haven't been able to figure it out.
On the other hand, if there is a way to load a script of arbitary length, I believe that will resolve my problem as well. Please let me know what additional information may be needed to help solve this, as I'm sure I've left out all the good bits.
Thank you in advance,
Landon
Edited for clarity.
Solved! Go to Solution.
07-06-2015 10:36 AM
Hello Landon,
Thanks for reaching out. Can you tell me what kind of error you receive when you try to run the long script?
Thanks,
07-07-2015 10:13 AM
Good morning Jonathan,
Thank you for your reply. I apologize for the delay in my response. Allow me to back up a little and give you some more information on the script.
The error is as follows:
Error - 1074116601 occurred at niHSDIO Write Script.vi Possible reason(s): Driver Status: (Hex 0xBFFA4807) Too many compiled instructions in loop. "Generate" and "Wait" instructions each result in at least one compiled instruction. Each marker adds an additional compiled instruction. Clear instruction does not result in a compiled instruction. If possible, reduce the number of generate instructions by concatenating the waveforms on two or more consecutive generate instructions. Line Number: 2 Position in Line: 1 Number of Instructions: 2048 Maximum Number of Instructions: 55 Status Code: -201016
I have a waveform that is 524292 cycles long and I want to run 384 cycles, wait for an external trigger, run another 384 cycles beginning at a new position, wait for the same external trigger, and loop that 1024 times. I thought scripting would work, but if there’s a better way please suggest it! I’m using a PXI-6551 with 64Mb/chan RAM in a PXIe 1062Q chassis with a PXIe-8370 controller cabled to a desktop Windows 7 box.
As previously mentioned, the smaller scripts function correctly when split into sections of less than 55 lines. See below for an example functioning script.
Clear scriptTrigger0 Generate mywfm subset(0,384) Wait until scriptTrigger0 Clear scriptTrigger0 Generate mywfm subset(512,384) Wait until scriptTrigger0 Clear scriptTrigger0 Generate mywfm subset(1024,384) Wait until scriptTrigger0 Clear scriptTrigger0 Generate mywfm subset(1536,384) Wait until scriptTrigger0 Clear scriptTrigger0 Generate mywfm subset(2048,384) Wait until scriptTrigger0 Clear scriptTrigger0 Generate mywfm subset(519168,384) Wait until scriptTrigger0 Clear scriptTrigger0 Generate mywfm subset(519680,384)
However, when the full script (attached in text file) is entered, the error is generated.
Thank you again for your time. Please let me know any additional information you may need.
Landon
07-07-2015 03:31 PM
Also worth mentioning, I'm using LabVIEW Version 13.0 (32-bit).
Thanks
07-07-2015 04:15 PM
Hello, can you tell me what version of HSDIO version you have? Also, there are no limiitations to how many lines you have...technically. However, there are limitations when you repeat instructions like you have here.
Is this a software or hardware trigger?
Also, please take a look at the NI Script Editor help so you can try to look at 'alternatives' to your scripting commands:
http://digital.ni.com/manuals.nsf/websearch/6435CEF3AEF4D0968625774600579B21
Also, please take a look at this White Paper regarding a potential memory allocation issue. Scroll down to #6, 'Calcuation of Script Size'. I hope these help.
Thanks,
07-07-2015 04:17 PM
Oops....here's the link to the White Paper:
http://www.ni.com/white-paper/7283/en/
Cheers,
07-08-2015 06:56 AM
Good morning,
I have NI-HSDIO v14.0 installed currently, and the trigger is a signal returned from the hardware. I am currently looking into your suggestions about memory allocation and alternative scripting commands.
Thanks again
07-08-2015 03:26 PM
It seems the answer was in the white paper. The code was being ran within a loop with a user-defined n (usually 1) that added some capibility but was unnecessary. Removing this loop seems to have fixed it. We have not yet ran the full script, but a version about half of the length of the full has worked successfully. I'm going to mark this solved, but I will report back any other troubles related to this here, should they arise.
Thank you again for all of your help!