Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send commands and data upon request

Hello guys, 

I have gpib-usb-hs+ module and I am required to send the following commands and data in the following sequence:

MLA18

{DATA} (6 BYTES)

UNL

MTA18

{DATA} (5 BYTES)

UNT

 

I need this exact sequence with no UNL or UNT at the beginning or the end where they are not a must.

Currently each time I send MLA my program sends automatically send UNL.

I have tried to use c# library and ATEasy programming.

 

Would be very glad to hear your opinion on this issue).

0 Kudos
Message 1 of 16
(2,001 Views)

I don't know exactly what UNL, UNT or MLA is, but assuming these are some constants related to Newline, line feed and based on your description of usage with GPIB.

 

These might be useful - https://www.ni.com/en-us/support/documentation/supplemental/06/termination-characters-in-ni-visa.htm...

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHpGCAW&l=en-US

https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Default-GPIB-termination-character/td-p/2425...

 

With additional details, the above links may be irrelevant

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 16
(1,957 Views)

Thank you for your reply. 

The links you sent are talking about various ending char, in my case the NI module adds a termination command (UNL-Unlisten) before every MLA(My listen address).

I need to find a solution to bypass this automatic addition. 

0 Kudos
Message 3 of 16
(1,944 Views)

This is the original IEEE-488 configuration with the very low-level communications.

> To SEND commands:

  • Setup Talk address (for controller)
  • Unlisten ('?')
  • Listen Address (particular instrument)
  • Data/Address Bytes

> To Hear Responses:

  • Set Listen Address (for controller)
  • Setup Talk Address (for particular instrument)
  • Receive Data/Address Bytes
  • Unlisten ('?')

Repeat for next instrument or continue to listen for further responses. 

 

Most of these low-level commands are handled within the simpler SCPI command sets. 

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 4 of 16
(1,926 Views)

I 100% agree with you, yet in my case I want to send MLA without UNL being sent automatically/by itself before MLA.

 

I need a clear package of 

MLA 

* DATA*

UNL 

MTA

* DATA*

UNT

 

no unnecessary addons

 

0 Kudos
Message 5 of 16
(1,902 Views)

In 488.2 the functions to use at the low GPIB level are SendCmds, SendDataBytes and RcvRespMsg.

SendCmds broadcasts data with the ATN line on to indicate it is a command, then the two other are used to  write/read data to/from a previously addressed device.

The MLAx command is to set device x as a listener and MTAx to set device x as a talker. 

 

Therefore your command/response sequence for device at address 18 will be something like:

SendCmds (code of  MLA18)                        //set it as listener

SendDataBytes ( data bytes)

 SendCmds( code of UNL, then code of MTA18)     //tell it data transfer is done then set it as talker 

RcvRespMsg             //receive data (until EOI or termination character, according to settings)

 SendCmds( code of UNT)                          //terminate

 

The command codes are listed in the GPIB488 reference manual as "Multiline Interface Messages" (appendix A1), also here:

https://www.ni.com/fr-fr/support/documentation/supplemental/06/gpib-messages.html

 

 

Message 6 of 16
(1,863 Views)

I am adding the base value plus the variable here.

 

MLA = 0x20 + Actual address (i.e. 7) -> 0x27

*DATA* = Just the intended data

UNL = 0x3F

MTA = 0x40 + Actual Address (i.e. 3) -> 0x43

*DATA*

UNT = Set to new talk address (Someone is always in control/talking)

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
Message 7 of 16
(1,856 Views)

hello,

thank you for the reply.

These commands you listed what library they are from? 

Currently i am working with C# libraries, and couldnt find a "SendDataBytes" command that doesnt send "UNL" before sending  the data.

Also the device i am trying to communicate with  doesnt use the EOI line, it sends me back data until i rise the ATN line with a "UNT" command to stop it.

which rises some question about how this bid-communication works,  after the MTA 18 am i pulling the data or the device is pushing the data towards me?.

0 Kudos
Message 8 of 16
(1,843 Views)

These are not libraries, but the actual hexadecimal coding for IEEE-488 (prior to SCPI).  It has been over 30 years since I had to communicate across GPIB with these low-level commands.  Here is something from NI concerning the commands.

 

BTW:

If you set MTA18, then the instrument at Address 18 will be sending data.  You should have the address of the PC/controller set to MLA1 assuming that it is at address 1 prior to setting the talk address to see all traffic/data.

 

Apparently, there is an UNT command as 0x5F which I never used.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 9 of 16
(1,834 Views)

aww, well i am trying to get as low as possible to understand why the device doesnt replies to me.

i have monitored how a different equipment that was developed for this device communicates with it and i have tried to repeat it yet not success.

 the main difference between it and mine code is that i am adding UNL and UNT in a different path, something that doesnt shouldnt bother (According the GPIB protocol), 

 

do you mean that when i send MTA18 the device starts controlling the bus (handshakes) and send  by "pushing" me data or i still control the bus and i pull the data byte by byte?

0 Kudos
Message 10 of 16
(1,823 Views)