Monday, December 17, 2012

SCPI Example and Tools for the 34970A and 34972A

In this post we will look at a Standard Commands for Programmable Instruments (SCPI) example for controlling Agilent's 34970A / 34972A DAQ / Switch Units remotely. In the example we will remotely monitor a channel and then setup and execute a scan. From there we will look at controlling the 34972A via its built-in web interface and how the web interface can be used as a SCPI programming tool for building a custom program.

In the following example a pseudo programming language is used around the SCPI examples. In our pseudo programming language "//' represents comments that will be used to explain what is happening in the demo as we go. The connect() function will be used to connect to the 34970A / 34972A (in our example we will be using a 34972A with LAN, but they each use the same SCPI language). The printf() function will be used to send a command to the 34972A. The query() function will be used to send a command and read back the response from the 34972A. The "data:" will be used to print out the response from the instrument. The SCPI commands will be handled as strings so they will be placed in quotation marks "". A newline "\n" character will be used after each command, depending on the programming language and driver you are using in your program this may or may not be needed.

In the following example we will monitor temperature measurement using a thermocouple J-type sensor. Next will execute a multiple channel.

//Connect to the 34972A via LAN using the IP address, the instruments hostname could also be used
instr = connect("555.555.555.555");
//send a reset so we are starting at a known state
printf(instr, "*RST\n");
//identify the 34972A we are talking to
data = query(instr, "*IDN?\n");
//display the returned identity of the 34972A
data: Agilent Technologies,34972A,ALFREDO172,1.11-1.12-02-01
//configure channel 12 in slot 1 for thermocouple J-type 
printf(instr, "CONF:TEMP TC,J,(@112)\n");
//set channel 12 in slot 1 to the channel we want to monitor
printf(instr, "ROUT:MON:CHAN (@112)\n");
//Start monitoring channel 12, the 34972A will now continuously make measurements on channel 12
printf(instr, "ROUT:MON:STAT ON\n");
//query for channel 112 measurement
data = query(instr, "ROUT:MON:DATA?\n");
//display channel 12 temp measurement in degrees C
data: +1.81960000E+01
//query for another channel 112 measurement (remember monitor runs continuously) 
data = query(instr, "ROUT:MON:DATA?\n");
//display channel 12 temp measurement in degrees C
data: +1.81760000E+01
//turn the monitor function off
printf(instr, "ROUT:MON:STAT OFF\n");
//Now lets setup the scan using four channels in slot 1, 2 temp measurements and 2 resistance measurements
//Since one temperature measurement has already been configured lets do the other
printf(instr, "CONF:TEMP TC,J,(@113)\n");
//Configure both of the resistance measurements
printf(instr, "CONF:RES (@103,108)\n");
//Create a scan list with the four channels
printf(intr, "ROUT:SCAN (@101,105,112,113)\n");
//set the scan list to run five times so we will have a total of 20 measurements (4 channels x 5 sweeps = 20)
printf(intr, "TRIG:COUN 5\n");
//run the scan list
printf(instr, "INIT\n");
//wait 2 seconds for scan to finish 
wait(2);
//get the 20 readings from the 34972A's memory
data = query(instr, "FETC?\n");
//display the readings from the scan
data: +2.85266320E+03,+1.49620420E+02,+1.75500000E+01,+1.77660000E+01,+2.85271470E+03,+1.49617860E+02,+1.75350000E+01,+1.77510000E+01,+2.85271470E+03,+1.49620420E+02,+1.75320000E+01,+1.77510000E+01,+2.85270180E+03,+1.49620420E+02,+1.75420000E+01,+1.77510000E+01,+2.85271470E+03,+1.49621710E+02,+1.75200000E+01,+1.77410000E+01
//clear the scan list (optional)
printf(intr, "ROUT:SCAN (@)\n");
//close the connection to the 34972A
disconnect(instr);

The 34970A and the 34972A, for the most part, offer the same functionality and measurement capability. The main differences come from the remote IO. The 34970A offers GPIB and RS232 connectivity and the 34972A offers LAN and USB connectivity. The 34972A also offers a built-in web interface that can be accessed via the LAN connection. All you need is a LAN connection and a web browser to access the 34972A's web interface. The web interface allows you to control the 34972A remotely and offers tools that help you create custom software for controlling the 34972A remotely.

A 34972A was connected to the same local LAN network that my PC was connected to. I obtained the 34972A's IP address from its front panel. I entered the IP address in the address bar of the web browser on my PC and I was able to connect to the 34972A's web interface. The below figure shows the web interface control page for the 34901A card in slot 1 of the 34972A. From this page I can close switches, monitor a channel, and create scans.


By selecting the "Utility..." button in, the SCPI programming tools can be accessed. As an example, the "Command Monitor" function in the Utility menu provides a list of SCPI commands that coincides with the settings and functionality that were implemented via the web interface. This allows you to mimic on the web interface what you plan to do in your software and then simply cut and paste the resulting commands from the Command Monitor into your program. The below figure shows the Command Monitor window with recorded commands that show a relay being opened and closed continuously, a channel being setup for monitoring, and the monitor reading being fetched from the 34972A. 



In this blog post we looked at some examples of how to remotely control the 34970A and 34972A using SCPI. We then looked at the LAN web interface on the 34972A and how it can be used as a tool for creating custom software based on SCPI. As always if you have anything to add use the comments section below and if you have any questions feel free to email me.

For more information on the 34972A click here

For more information on the 34970A click here

For more information on a free program for controlling the 34970A and the 34972A click here

59 comments:

  1. Replies
    1. عن
      شركة مكافحة حشرات بالرياض القضاء على الحشرات المنتشره فى كافة اركان المنزل لذا اذا كنت بحاجه الى
      شركة رش مبيدات بالرياض متخصصه فى القضاء على كافة الانواع المختلفه من الحشرات الطائره والزاحفه فان شركة البراك تعد من افضل شركة رش مبيد بالرياض ، فالشركة تقدم
      مكافحة حشرات بالرياض باستخدام المعدات التى تساعد على القضاء على الحشرات جذريا وفى وقت بسيط بمجرد استخدام ادوات رش مبيدات بالرياض
      كما تمتلك الشركة
      رش مبيدات لها سمعتها الكبيره فى التخلص من الحشرات بانواعها المختلفه
      شركة مكافحة الفئران بالرياضتمتلك فريق عمل كبير جد\ا كل مهمته توفير واستخدام كل الفرص المتاحه من الادوات والمبيدات فى القضاء ومكافحة الحشرات بالطائف المنتشره بانواعها المختلفه
      فقد تكون من اكثر الاشخاص الباحتين عن شركة مكافحة النمل الابض بالرياض لما له من اثار خطيره على عفش المنزل فهو يقوم بتاكل عفش منزلك ويستطيع ان يتغذى على الخشب المكون منه اثاث المنزل لذا ينصخ يالبحن عن شركة مكافحة النمل الابيض بالرياض لها القدره على التخلص من النمل بكافة انواعها وكذلك التخلص من اليرقات التى تنتج عن هذا النوع
      من الاخطار الكبيره ايضا للنمل الابيض وهو انتشاره بكثره فى اساسات المنازل ويسكن فى البنيه التحتيه ويستطيع ان يسبب تاكل كبير فى البينه التحتيه الامر الذى يستلزم عليك شركة رش مبيدات بالرياض تستخدم المبيدات المختلفه للقضاء على هذا النوع منه فورا واعطاء كافة الضمانات التى تمنع من انتشار هذه الحشرات مره اخرى كذلك نمتلك شركة مكافحة النمل الابيض بالرياض تمتلك انواع مختلفه من المبيدات ذات الروائح النفاذه والاخرى التى لا تمتلك ايه الروائح كذلك استخدام الحقن الالمانى كل هذا لن تجده غير فى شركة مكافحة حشرات بالقصيم للتخلص فورا من الحشرات

      Delete
  2. Replies
    1. كنت تبحث عن شركة نقل عفش بالرياض لنقل عفش منزلك نيجة للسفر او الهجره او الانتقال فان شركة البراك تعد من اهم شركات نقل عفش بالرياض لها سمعتها الكبيره فى اعمال نقل وتخزين الاثاث فهى ايضا
      شركة تخزين عفش بالرياض لتخزين الاثاث لفترات اذا منت بحاجه الى تخزين الاثاث . شركة البراك
      شركة تخزين عفش بالرياض تمتلك العماله المدربه فى اعمال فك وتركيب الاثاث وكذلك تغليف الاثاث حتى لا يتعرض الى خدوش او كسور اثناء عمليات النقل المختلفه
      كما اننا نمتلك شركة نقل عفشوكافة فروع المملكه كما ان الشركه ليها اسطول كبير جدا من سيارات نقل الاثاث المختلفه وبكافة الاحجام كما تمتلك اسعار مناسبه جدا لكل حجم من احجام الاثاث لذا اذا كنت تبحث عن شركات نقل عفش بالرياض تمتلك عماله مدربه ولها القدره على نقل الاثاث من والى اصعب المناطق او نقل الاثاث خارج المملكه فان شركة البراك تعد خيارك الاول فى خدمات نقل العفش وتخزينه وكذلك شراء الاثاث المستعمل
      عند طلب خدمان شركة نقل عفش بالرياض فان الشركه تقوم بارسال مندوب لمعاينه الاماكن التى ستم نقل الاثاث منها واليها وكذلك حجم الاثاث ومداخل ومخارج الاماكن كما يقوم بتحديد حجك الاثاث للاتفاق مع الاسعار المناسببه لخدمات نقل العفش . بعد ذلك سيقوم بارسال فريق عمل كمنا بتحديده نتيجة لكمية الاثاث التى تمت معاينتها من قبل مندوب الشركه
      يقوم العمال باعمال الفك والتغليف حتى يتم ضمان الاثاث اثناء عملية النقل وعدم تعرضه الاثاث لاى مشاكل اثناء تحرك وانتقال السياره كذلك اثناء التحميل الامر الذى يتطلب استخدام بعض الانواع المختلفه من المغلفات التى تساعد على تغليف الاثاث باحكام وعدم تعرضه لاى احتكاك اثناء الانتقال من مكان الى اخر
      فى افضل لم تجد الا موسسة البراك تهتم دائمة بمواكبه كل جديد من الادوات والمعدات ومن السيارات التى تساعدنا على تقديم خدمات نقل عفش بطريقه احترافيه تمنع حدوث اى مشاكل اثناء عملية التحميل والنقل والتركيب فى موسسة البراك نراعى دائما طلبات العملاء وتقديم كافة النصائح اللازمه التى تساعدنا على اتمام عملية النقل بكل سهوله ويسر
      دائما ما تبحث عن اارقام شركات نقل عفش بالرياض فى صفحات الانترنت دون معرفه مسبقه عن خدمات الشركه التى تقوم بطلبها لذا ننصح دائما بالبحث عن توصيات عملاء سابقين ومدى ثقة العملاء فى الشركه وفى الخدمات التى تقوم بها الشركه ومن الخدمات اضا التى تشتهر بها شركة البراك ايضا ارقام شركة نقل عفش بالرياض وتقدم خدمات اخرى باضافة لفك وتركيب الاثاث اثناء نقل الاثاث

      Delete
  3. You may be interested in this site, if you ever asked yourself a question "who do I pay to do college homework"

    ReplyDelete
  4. I just want to tell you that I’m all new to blogging and site-building. I really loved your web page. Very likely I’m want to bookmark your site . You amazingly have remarkable posts. Thanks a bunch for sharing your blog.
    Regards - www.office.com/setup
    www.office.com/setup
    www.office.com/setup

    ReplyDelete

  5. Oh my goodness! Impressive article dude! Thanks, However I am going through issues with your RSS. I don’t know why I can't subscribe to it. Is there anybody having identical RSS issues? Anybody who knows the answer can you kindly respond? Thanks!!
    imessage download for windows, imessage for android app is a common informing application for the Apple gadget clients like iPad, iPhone and Mac. This application enables you to send content to any individual who is accessible on your contact list and has this application introduced on his/her Apple gadget.

    ReplyDelete
  6. mcafee com activate
    This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more. Great Experience!

    ReplyDelete
  7. I feel it interesting, your post gave me a new perspective! I have read many other articles about the same topic, but your article convinced me! I hope you continue to have high quality articles like this to share with veryone!
    happy wheels

    ReplyDelete
  8. Expert’s consultation is also available for students. If they have any query they can contact with our experts anytime.
    Programming Assignment help

    ReplyDelete
  9. Background Removal Services (BRS) is one of the best Clipping path service provider around the world. We offer our global customers: Raster to Vector Services, Photo Restoration Services Prices, Photo Neck Joint Service, Exposure Color Correction Service, Jewelry Photo, Retouching Services, Photo Color Correction Service, Image Mirror Effect Service, Cheap Retouching Services, Deep Etching Service,

    ReplyDelete
  10. Turbo Steam is a powerful, yet portable, fabric and clothes steamer for all of your steaming needs. Our Turbo Steam takes only 45 seconds to heat up and to start generating steam and its steam delivery system evenly distributes steam across fabrics to remove even the worst wrinkles.

    ReplyDelete
  11. أفضل شركة نقل في المدينة المنورة والنجارين المبهرين في تفكيك وتركيب الأثاث والمفروشات.

    ReplyDelete
  12. Read the Best Massager Reviews of 2019 Find out which is the best model on the market and the health benefits of using a Best Massager Reviews.

    ReplyDelete
  13. Prom Dress Hut is a prom dresses company. If you are looking for a prom dress, check out our Latest Prom Dress Collection. You can order from Prom Dresses USA, Prom Dresses UK, Prom Dresses Australia, Prom Dresses Canada, and Prom Dresses Germany.

    ReplyDelete
  14. Which Best Foot Massager To Buy – Which Foot Massager Is Right For You? If you ask which Foot Massager model is the finest this year, certainly I would recommend going through this guide to know which Best Foot Massager is actually market leaders.

    ReplyDelete
  15. Read the best Foot Massager Reviews of 2019 Inthe following article, we present the top 8 models available today and revealtheir pros and cons.

    ReplyDelete
  16. Students Assignment Help offers global assignment help services to the university and college students around the world. Our experts are available at any time for your help so just email us at info@StudentsAssignmentHelp.com

    ReplyDelete
  17. The professional Assignment Experts at SingaporesAssignmentHelp.com hold masters and Ph.D. degrees from the eminent universities in singapore. Our writers will exceed all your expectations and will easily submit your My assignment help without any delay.

    ReplyDelete
  18. office.com/setup is a product ofoffice setup. Get Support if you face problem to activate office.com/setup or mcafee.com/activate install Microsoft Office product. Install with Product Key.
    norton.com/setup is one of the best Security Antivirus product can completely Call qui protect your digital life online. You can securely surf the Internet with the To activate your with product key you can visit norton.com/setup.


    office.com/setup | norton.com/setup

    ReplyDelete
  19. Get FREE account and technical support for your McAfee consumer products and services. Find solutions to top issues online. Live support via chat and phones.
    mcafee.com/activate
    mcafee activate
    mcafee my account

    ReplyDelete
  20. Information from this blog is very useful for me, am very happy to read this blog Kindly visit us @ Luxury Watch Box | Shoe Box Manufacturer |  Candle Packaging Boxes

    ReplyDelete
  21. Geek Squad Protection Plan is an insurance scheme offered by Geek Squad Support. The experts available at the helpline for this insurance plan are much aware of the Geek Squad Protection and its advantages.

    ReplyDelete
  22. AOL Tech Support Phone Number is a customer care helpline that is offered by one of world's best mail service provider. The experts at this toll-free helpline renders all your forget password, password recovery and other related issues. Reach them anytime of day or night at AOL Tech Support whenever you need their help.

    ReplyDelete
  23. Acer Support is a team of well experienced experts who takes care of your Acer devices. If you are facing any problem with your Acer device like your device is crashed, device is not working properly or any other problem then contact toll free number of Acer Tech Support and get instant help.

    ReplyDelete
  24. Epson Printer Support is available whole day and night to resolve your printer problems. If you face any problem with your epson printer device like device is not working properly, cable problem, cartage problem, blank screen and others then contact at Epson Support and resolve your issue in no time.

    ReplyDelete
  25. Dell Printer Support is a team of well experienced experts who takes care of your dell device problems. If face any problem with your device like your device is crashed, device is not working properly, paper jamming or others then contact at Dell Support and get instant help.

    ReplyDelete
  26. Brother Printer Support team handles all the tech issues like paper jamming, improper cable connection, ink issues etc. perfectly. Brother Support team is active 24/7 for customer satisfaction, In case of any Printer issues contact Brother Printer Support.

    ReplyDelete
  27. Brother Printer Support is team of well experienced experts who are capable to resolve your printer issue. If you face any problem with your printer like cable problem, blank screen issue, or your printer is not working properly then reach our experts by making a call at toll free number of Brother Support helpline and get instant help.

    ReplyDelete
  28. Thank you so much for sharing such a superb information's with us. Your website is very cool. we are impressed by the details that you have on your site.we Bookmarked this website. keep it up and again thanks
    office.com/setup | office.com/setup | office.com/setup | mcafee.com/activate | billy mark | office.com/setup

    ReplyDelete
  29. Canon Printer Support is a team of experts who takes care of your canon device issue. If face any problem with your device like your device is crashed , device is not working properly or others then contact Canon Support and get instant help.

    ReplyDelete
  30. HP Support is a group of experts who deals with every issue with your HP devices. These experts are proficient enough to give you the best of services.HP Support experts are quite efficient in giving repair services.

    ReplyDelete
  31. Dell Support is a team of experts who take care of your dell device issue. If face any problem with your device like your device is crashed , device is not working properly or others then contact Dell Tech Support and get instant help.

    ReplyDelete
  32. HP Printer Support is active helpline that is available round the clock to resolve Hp printer problems. If you face any problem with your printer like device is not working properly, paper jamming issue, cable wire problem and others then reach experts of HP Printer Support and get instant help.

    ReplyDelete
  33. Thank you so much for sharing these amazing tips. I must say you are an incredible writer, I love the way that you describe the things. Please keep sharing.

    For more information visit on office.com/setup | office.com/setup | office.com/setup | Norton.com/setup

    ReplyDelete
  34. You know, I had one other person saying this (in a less friendly way) and I figured it was just another case of somebody actively seeking to be offended in some way by completely misreading the context of the statement. Which is obviously not written with a goal to offend the group you describe. But that website does provide a useful background, so you changed my mind.


    office.com/setup

    office.com/setup

    Mcafee.com/Activate

    office.com/setup

    ReplyDelete
  35. To protect all your Windows, Mac & Android devices. Get and easily run Anti Viruses and Learn how to create anti- virus account, enter 25 characters alpha-numeric Product Key/code, and successfully install with the Product key.office-setup is a product of office setup. The if you support the Get facing problem to activate the office-setup or the install the Microsoft Office product product. Install with Product Key.

    mcafee.com/activate | norton.com/setup | office.com/setup | norton.com/setup | office.com/setup

    ReplyDelete
  36. Get robust protection by downloading and installing the McAfee antivirus. Go to mcafee.com/activate and enter the product key to activate your McAfee product. Set up Office 365 and Office 2016 from office.com/setup. Easily get 25 digits Activation key for downloading, installing and activating Office Setup on Windows or Mac device. Create an account on McAfee website at mcafee.com/activate and then go through the downloading, installing and activating the process.

    ReplyDelete
  37. To activate the Norton antivirus a string of numbers and letters used that is called Norton product activation key. norton.com/setup | www.norton.com/setup

    ReplyDelete
  38. McAfee.com/Activate is a place where you can activate the retail card you purchased over the counter. mcafee.com/activate | www.mcafee.com/activate


    ReplyDelete
  39. There are many types of internet viruses, Trojans, malware, and spyware which can affect the security and performance of your system or computer. mcafee.com/activate | www.mcafee.com/activate

    ReplyDelete
  40. This is a step by step guideline to take you through installing Microsoft Office on your PC or laptop. office.com/setup | www.office.com/setup

    ReplyDelete