Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem with the termination character when sending a message on the GPIB. Default character is line feed and my instrument needs a carriage return.

I´v tried to change it but when I sniffing at the bus it is still line feed. Anyone knows what I´m doing wrong?

As I understand instrEprobe.IO.TerminationCharacter only affects the receiving message from instrument but I need to send message with carrage return and not line feed.

BR Niklas

What I have tried:

Public Function InitEprobe(ByVal strGpib As String, ByVal Type As String)
        ioMgr = New Ivi.Visa.Interop.ResourceManager
        instrEprobe = New Ivi.Visa.Interop.FormattedIO488

        instrEprobe.IO = ioMgr.Open("GPIB0::" & strGpib) 'set GPIBport
        instrEprobe.WriteString("I") 'Send command to instrument
        Return = instrEprobe.ReadString 'Read instrument
                    
End Function
Posted
Updated 27-Sep-21 5:29am

1 solution

This is how I understand the documentation:
- TerminationCharacter is used during serial reads to locate end of message;
- TerminationCharacter is optionally sent during serial writes, depending on the value of some "End Mode for Write".

When your instrument wants different termination characters for reads and writes (which I would consider quite remarkable), you might try changing TerminationCharacter before and after each WriteString, however that might fail depending on when exactly the value of it gets used by the input driver.

The solution that should work for sure is:
- set TerminationCharacter to the character required for reads;
- disable the use of TerminationCharacter for writes;
- append your chosen termination character explicitly yourself to the string parameter of every relevant call to WriteString.

:)
 
Share this answer
 
Comments
Member 14167751 28-Sep-21 4:55am    
Thank you for your answer. The thing is that if I Disable the character for write and add it manualy it will also disable the EOI. It will not work either. Or kan you help me with a code so I understand you correct?
Luc Pattyn 28-Sep-21 8:27am    
That is confusing, first you said "my instrument needs a carriage return" and now you imply an EOI is needed. It should be one or the other, not both.
Member 14167751 28-Sep-21 10:04am    
This is the text from the manual
When sending commands to the unit via the GPIB interface, the command must be terminated with an EOI
and a carriage return <cr>.
Luc Pattyn 28-Sep-21 10:12am    
Very strange. What is this instrument? And can you provide a link to that manual?

Assuming their statement is correct, you should set TerminationCharacter to CR, enable the use of TerminationCharacter on writes, and just hope the answer will also end on CR. Try it!
Member 14167751 29-Sep-21 2:31am    
Hello. As I understand, gpib messages very common ends with an line feed(EOS) and EndOrIdentify(EOI).
With the SendEndEnable = True a linefeed + EOI is added to the message, I need to change the linefeed to Carrage return. With SendEndEnable = false and I manually add the Cr, the linefeed disappear and the Cr is there but no EOI.
The instrEprobe.IO.TerminationCharacter only affect when I read from instrument.

The Instrument is a Electric field probe from Amplifier Research. There is unfortunately no manual on the web.

I have verify this problem with NI MAX send message end with CR + EOI it works perfect

BR

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900