element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Test & Tools
  • Technologies
  • More
Test & Tools
Forum MULTICOMP PRO MP750065 Function Generator - Programming Pt1: SDK Demo
  • Blog
  • Forum
  • Documents
  • Events
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Test & Tools requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 8 replies
  • Subscribers 210 subscribers
  • Views 816 views
  • Users 0 members are here
  • MP750065
  • function_generator
  • labview
  • scpi
Related

MULTICOMP PRO MP750065 Function Generator - Programming Pt1: SDK Demo

Jan Cumps
Jan Cumps 5 months ago

The first post in this Program the Device series talks about the USB driver, additional software and an optional test with the UNI-T SDK demo. 
There is a pre-history where several options were discussed: MULTICOMP PRO MP750065 Function Generator - 1st impressions.
For the MP750668, UTG900C-II, UTG1010 owners: this will very likely work for you too.
That is: if I get it working. I'm blogging while building. At this time: end-to-end communication with UNI-T's demo program is working - outside LabVIEW. And I mocked a valid UNI-T api interaction in LabVIEW. 


image: sneak preview of the LabVIEW initial flow

Software stack

I'm not using the NI-VISA driver for this device, but the driver that comes with the kit. In LabVIEW, .NET is the integration mechanism of my design.
Software used:

  • driver that comes with the device: libusb-win32 (I happen to have v1.2.6.0).
  • UNI-T's uci.dll. Available if you install Device Manager from the instrumen's cd, and in the UNI-T's SDK examples for the UTG1010.
    It has to be the ascii version. More on that when I go into LabVIEW integration.
  • LabVIEW Community Edition, in particular the .NET palette.


image: this is how the device should look like in Windows Device Manager

For instrument testing and bookkeeping, the following utilities helped:

  • Zadig, to re-apply the libusb-win32 driver easily if another one is active in Windows.
  • UNI-T's SDK examples for the UTG1010. In particular the  UCI Demo program.

The additional software that comes with the instrument, Device Manager, is not a prerequisite for this.

Test with UNI-T demo program (optional)

minimum requirements:

  • USB driver installed and device connected, powered on.
  • UNI-T SDK examples zip file extracted.
  • Windows Desktop Scale set to 100% when starting the demo. Else the connect string will not fit in the edit field.
    After entering the connect string, you can set the scale back to its original setting.
  • Programmer's Guide

Start the demo, found in SDK V3.0-English\SDK V3.0-English\SDK V3.0-English\UCIDEMO\Unicode.
The interface is in a mix of English and Chinese. I used Yandex to translate it:


image: the UNI-T SDK Demo, with Chinese text translated to English via Yandex online image translator

You can try to see if the Query button works and retrieves your device settings. For me it didn't. In that case, enter this string in Device address: 
[C:SG][D:DDSFG][T:USB][PID:0x1234][VID:0x5345][EI:0x81][EO:0x3][CFG:1][I:0][addr:0][IDN:DDS%**]


image: How to connect

Number of bytes read is not relevant at this time. Keep whatever value is there.
The result should be that you get a success message. And the Connect button becomes a Disconnect button.

You can now enter some query and set commands, in the Input command edit field.
For commands that don't return a value (set commands), you can either hit the enter key in the edit field or use the Write parameters button.
For commands that query the instrument, you have to provide the expected return data size, and use the Read parameters button.

Exercise1: change the frequency to 2 kHz
enter wp@CH:0@addr:0x8009@v:2000;
Click  the Write parameter button
Watch the instrument frequency
Watch the demo program log


image: the device after setting the frequency to 2 kHz


image: Demo shows the success of the call

Exercise2: read the current set frequency
enter rp@CH:0@addr:0x8009;
enter Number of bytes: 8 (check the program manual for the size of each read command's reply).
Click  the Read parameter button
Watch the demo program log


image: Demo shows results of the call

The return value is an 8 bytes double.
I used Greg Stoll's converter to verify this:


image: Greg Stoll's hex-to-double online analyser

You can now disconnect and close the demo. Next post is the LabVIEW USB init and teardown flow.

Related blog:

MULTICOMP PRO MP750065 Function Generator - 1st impressions
Programming Pt1: SDK Demo
Programming Pt2: LabVIEW tryout (a)
Programming Pt3: LabVIEW tryout (b)
Programming Pt4: LabVIEW Driver Lib Init block
Programming Pt5: LabVIEW Driver Lib Read, Write and Close blocks
Programming Pt6: LabVIEW Driver Lib: High Level Functional blocks
  • Reply
  • Cancel
  • Cancel

Top Replies

  • Jan Cumps
    Jan Cumps 5 months ago in reply to Jan Cumps +3
    Jan Cumps said:

    Note 2 to self: the instrument ignores what I write.
    I may switch to this method to use the uci.dll and uci.h directly: knowledge.ni.com/KnowledgeArticleDetails

    edit: although Note 2 doesn…

  • scottiebabe
    scottiebabe 5 months ago in reply to Jan Cumps +2

    Sad Panda face. I can feel your pain from days past. Trying to import the ni-visa dll into matlab wasn't fun when I tried years ago. https://github.com/sstobbe/mlab/blob/master/VISA32/VISA32.m#L58 Having done it…

  • Jan Cumps
    Jan Cumps 5 months ago in reply to scottiebabe +1

    I tried to use that DLL in LabVIEW, but it doesn't want to eat it:

    Current plan is to work on the USB driver level of libusb: the interface IUSBDriver that it exposes.
    I haven't done anything like…

  • scottiebabe
    scottiebabe 5 months ago

    I used the included libusb drivers and my arb shows up as:

    and, 

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
  • Jan Cumps
    Jan Cumps 5 months ago in reply to scottiebabe

    The mysteries of USB :) - I can make it show as Freescale and Cypress/Infineon too:

    Both (libusb-win32 and libusbK) drivers work exactly as if I select the one that came with the device.

    It seems to depend on what evaluation kits you've installed in the history of your PC ...

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
  • scottiebabe
    scottiebabe 5 months ago in reply to Jan Cumps

    lol its magic Sparkles!!! I don't know if you are planning to try low level usb, but I used the uci.dll. I had to remove the unicode comments for matlab to be happy and used the ASCII string version 

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
  • Jan Cumps
    Jan Cumps 5 months ago in reply to scottiebabe

    I tried to use that DLL in LabVIEW, but it doesn't want to eat it:

    Current plan is to work on the USB driver level of libusb: the interface IUSBDriver that it exposes.
    I haven't done anything like this before - never did .NET or talk USB - let alone in LabVIEW. I used either the serial/COM way (for my self-built SCPI lab devices) or the NI-VISA way.

    • Cancel
    • Vote Up +1 Vote Down
    • Reply
    • Cancel
  • scottiebabe
    scottiebabe 5 months ago in reply to Jan Cumps

    Sad Panda face. I can feel your pain from days past. Trying to import the ni-visa dll into matlab wasn't fun when I tried years ago. https://github.com/sstobbe/mlab/blob/master/VISA32/VISA32.m#L58 Having done it before it wasn't too bad to do it again.

    • Cancel
    • Vote Up +2 Vote Down
    • Reply
    • Cancel
  • Jan Cumps
    Jan Cumps 5 months ago

    note to self: translate LabVIEW / LibUsbDotNet endpoint IDs to the addresses of the instrument driver [EI:0x81][EO:0x3]

    https://github.com/GeorgeHahn/LibUsbDotNet/blob/master/LibWinUsb/Main/ReadEndpointID.cs

    public enum ReadEndpointID : byte
    {
      /// Endpoint 1
      Ep01 = 0x81,

    https://github.com/GeorgeHahn/LibUsbDotNet/blob/master/LibWinUsb/Main/WriteEndpointID.cs

    WriteEndpointID : byte
    {
      /// Endpoint 3
      Ep03 = 0x03,

    Note 2 to self: the instrument ignores what I write.
    I may switch to this method to use the uci.dll and uci.h directly: knowledge.ni.com/KnowledgeArticleDetails

    edit: although Note 2 doesn't return from the first call. Regardless if I use uciOpen() or uciOpenX()

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
  • Jan Cumps
    Jan Cumps 5 months ago in reply to Jan Cumps
    Jan Cumps said:

    Note 2 to self: the instrument ignores what I write.
    I may switch to this method to use the uci.dll and uci.h directly: knowledge.ni.com/KnowledgeArticleDetails

    edit: although Note 2 doesn't return from the first call. Regardless if I use uciOpen() or uciOpenX()

    scottiebabe wrote that he had success with UNI-T's uci dll in MathLab. 
    So when my raw USB approach didn't work, I read up to see how I can call dll functions in LabVIEW, and gave it another try.

    This turned out to work. LabVIEW can't import the uci.dll functions automatically. It has a wizard for that but hangs when I give it the .dll and .h file.
    But there's a manual way too: the function block "Call Library Function Node" where you can define the function's signature manually:

    ... and that works.

    The first call used to hang too, but when I changed the calling convention to WINAPI, it started to magically work.

    Action photo, where the device is connected, set to 3 kHz, then disconnected:

    Now that I have a working example, I'll rewrite the blog above to adjust the approach and dependencies. Next post I'll dig into the example.

    The flow as preview:

    • Cancel
    • Vote Up +3 Vote Down
    • Reply
    • Cancel
  • Jan Cumps
    Jan Cumps 5 months ago

    part 2: MULTICOMP PRO MP750065 Function Generator - Programming Pt2: LabVIEW tryout (a)

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube