Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

script syntax and errors in PXI-6551

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

0 Kudos
Message 1 of 11
(5,100 Views)

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

0 Kudos
Message 2 of 11
(5,079 Views)

Hello Anand,

Seems like you have everything under control. 

Thanks

nAyer

0 Kudos
Message 3 of 11
(5,066 Views)

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

0 Kudos
Message 4 of 11
(5,060 Views)

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

0 Kudos
Message 5 of 11
(5,047 Views)

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.

0 Kudos
Message 6 of 11
(5,037 Views)

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

0 Kudos
Message 7 of 11
(4,956 Views)

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

0 Kudos
Message 8 of 11
(4,952 Views)

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

0 Kudos
Message 9 of 11
(4,930 Views)

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

0 Kudos
Message 10 of 11
(4,919 Views)