Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

MessageBasedSessionWriter number of bytes sent from WriteLine method

Does anyone know the number of bytes that gets sent from a MessageBasedSessionWriter's WriteLine method?

Although the WriteLine method works for all my other, shorter commands, I've found a couple of long-command cases where it is not sending everything I pass to it.  Changing the MessageBasedSession's Default buffer size has no effect.  If I send the same string through the Measurement and Automation Visa console, it works fine.   

 

I'm able to use the Write() Method and then send a flush and "\n" afterwards and it works but changing this will break my interface, so I'd like to avoid it.

 

Anyone know what the size of write is for WriteLine? Or better yet, how to make it bigger?

 

0 Kudos
Message 1 of 3
(3,459 Views)

Hi lcorrigan,

 

I have the following questions:

  1. Which of the overloaded WriteLine() methods are you using?
  2. Would it be possible to show us the command that fails and one that successfully transmits?
  3. Please start a NI-SPY Capture session before you execute WriteLine(). I am curious of what is actually being sent to the internal viWrite() function.

Thanks

 

Nestor
0 Kudos
Message 2 of 3
(3,432 Views)

Hi Nestor,

 

1) It is the WriteLine(string) method that is not working for me.

 

2) The command that fails is WriteLine(":LIST:FREQ 100000000, 450000000, 450500000, 451000000, 451500000, 452000000, 452500000, 453000000, 453500000, 454000000, 454500000, 455000000, 455500000, 456000000, 456500000, 457000000, 457500000, 458000000, 458500000, 459000000, 459500000, 460000000, 460500000, 461000000, 461500000, 462000000, 462500000, 463000000, 463500000, 464000000, 464500000, 465000000, 465500000, 466000000, 466500000, 467000000, 467500000, 468000000, 468500000, 469000000, 469500000, 470000000, 470500000, 471000000, 471500000, 472000000, 472500000, 473000000, 473500000, 474000000, 474500000, 475000000"). 

This gives a Program Error, code -280 and the SigGen shows it was given a bunch of unrecognizable characters.  Oddly enough, the frequencies have all been programmed into the SigGen.    The MessageBasedSessionWriter help file says: "

Writes an ASCII-encoded string followed by a new line terminator ('\n') to the VISA session, and writes all unsent data from the internal buffer.[C#] public void WriteLine(string); "

 

I think it is writing everything it can hold, then sending the newline, and then flushing the internal buffer, but everything before the newline isn't everything I want to send.  I've had similar problems sending a binary setup file (big) to an oscilloscope.

 

Using the following command set with the above cmd string works fine:

-> writer.Write(cmd)

-> writer.Flush()

-> writer.Write("\n")

 

3) The commands I send from start to finish are attached, as well as spy captures from the WriteLine() and Write() versions described above.

 

 

0 Kudos
Message 3 of 3
(3,423 Views)