05-06-2009 09:47 PM
Hello,
I type in the following script in visual basic and get a 'keyword not found' error message. What might I be doing wrong? Thanks for any assistance.
myscript = "script commscript" & vbCrLf & _
"clear scripttrigger0" & vbCrLf & _
"generate wfm1" & vbCrLf & _
"generate wfm2" & vbCrLf & _
"repeat 59" & vbCrLf & _
"wait until scripttrigger0" & vbCrLf & _
"generate wfm3 marker0" & vbCrLf & _
"generate wfm4 marker0" & vbCrLf & _
"generate wfm5 marker0" & vbCrLf & _
"generate wfm6 marker0" & vbCrLf & _
"generate wfm7 marker0" & vbCrLf & _
"generate wfm8 marker0" & vbCrLf & _
"generate wfm9 marker0" & vbCrLf & _
"generate wfm10 marker0" & vbCrLf & _
"generate wfm11" & vbCrLf & _
"end repeat" & vbCrLf & _
"end script"
CheckErr WriteScript(viGenSession, myscript)
Error Found!
Code: -1074115612
DAQmx Error -200027 occurred:
Measurements:
Keyword was expected, but not found in the script.
Thanks
Anand
05-07-2009 01:38 PM
It seems that the marker syntax is wrong. I tried marker0(0) indicating that the marker event is generated at the 0th sample. Now I don't get a keyword missing error.
Anand
05-07-2009 04:03 PM
Hello Anand,
Seems like you have everything under control.
Thanks
nAyer
05-07-2009 09:11 PM
Not really,
Now I get an error message that the script cannot be identified. It wants me to make sure that I'm not referring incorrectly (wrong name) to the script. I appreciate any tips to help with this.
Thanks.
Anand
05-08-2009 08:35 AM
Hello Anand,
Can you tell me little bit more about your application, what drivers are you using and what do you want to do?
Thanks
05-08-2009 10:38 AM
Hey Anand,
I would suggest that you check out the VB example program called VB6 niHSDIO - Dynamic Generation with Script. Can you run this code with no errors? You could then edit this code a little bit to run with your script, and see what happens. Let us know how things go. Thanks, and have a great day.
Regards,
DJ L.
05-26-2009 12:52 PM
Hello,
I found that if there is only one script in the HSDIO, using the function call
CheckErr ConfigureScriptToGenerate(scriptname) AFTER the function call
CheckErr WriteScript(scriptname)
causes an error when the function call
CheckErr initiate(scriptname) is made.
Please do check this with visual C at your end.
Once I deleted the 'ConfigureScriptToGenerate(scriptname)' function call I was able to get the script to run.
I still have a bug in my scripttrigger setup which I can hopefully sort out soon.
Thanks.
Anand
05-26-2009 04:08 PM
Hi All,
Still problems with scripting. Here's an example script. The goal of the repeat loop is to repeat a fixed number of times (here 5), but each iteration must occur on scriptTrigger0. What might I be doing wrong? It does not repeat 5 times and sometimes all waveforms do not get generated.
myscript = "script myScript" & vbCrLf & _
"clear scriptTrigger0" & vbCrLf & _
"generate wfm1" & vbCrLf & _
"generate wfm2" & vbCrLf & _
"repeat 5"
"wait until scriptTrigger0"
"clear scriptTrigger0"
"generate wfm3 marker0(0)" & vbCrLf &_
"generate wfm4 marker0(0)" & vbCrLf &_
"generate wfm5 marker0(0)" & vbCrLf & _
"generate wfm6 marker0(0)" & vbCrLf & _
"generate wfm7 marker0(0)" & vbCrLf & _
"generate wfm8 marker0(0)" & vbCrLf & _
"generate wfm9 marker0(0)" & vbCrLf & _
"generate wfm10 marker0(0)" & vbCrLf & _
"generate wfm11" & vbCrLf & _
"end repeat" & vbCrLf & _
"end script"
Is there a syntax error with the repeat statement?
Please help.
Thanks.
Anand
05-27-2009 11:23 AM
Hello All,
In addition, scriptTrigger0 is set for rising digitaledge detection at PFI1 with a function generator supplying a 1kHz square waveform. When I change the waveform frequency to 2, 3 or even 4kHz, I notice a few more sets of the 9 waveforms being generated.
Please advise.
Anand
05-27-2009 07:31 PM
Hi All,
Some more observations
1. scriptTrigger0 is recognized reliably only once and if at all again, only a partial number of the nine desired waveforms are generated.
2. removing the 'clear trigger, wait until trigger' and introducing 'repeat forever' does not cause the loop to repeat forever.
3. I know that the trigger is indeed being recognized but just once reliably.
Can someone at National Instruments PLEASE respond. We do have an account for telephone technical support but this is a real hardware problem that has baffled me for a past few days.
Thanks
Anand