element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
  • Settings
Test & Tools
  • Technologies
  • More
Test & Tools
Blog Programmable Electronic Load - Write a LabVIEW Library part 1: Initialise Block
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Test & Tools to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 7 Jan 2018 4:53 PM Date Created
  • Views 2407 views
  • Likes 6 likes
  • Comments 6 comments
  • msp432
  • labview
  • scpi
  • electronic load
Related
Recommended

Programmable Electronic Load - Write a LabVIEW Library part 1: Initialise Block

Jan Cumps
Jan Cumps
7 Jan 2018

Peter, Jon and I are building a Programmable Electronic Load. In this series of blogs I'm building a LabVIEW library of reusable components

 

image

 

In this first article: Initialising the instrument

 

LabVIEW has a set of blocks to build flows with serial communication devices. Those blocks work well with our instrument.

However, inspired by the example for the Rigol DP8xxx family, I'm going to create more abstract blocks.

You can then use these in a LabVIEW flow.

To show the difference between using the serial blocks or a low level integration, check these two flows:

 

The first one uses the Serial blocks. You set all communication parameters and then can shoot SCPI commands and read them back.

You'll see that this is simple, but has no device or error management

imageimage

When you look at the same flow using a (built in this blog) abstract block, it looks like this:

  imageimage

This block hides the communication settings that aren't configurable (the serial settings are fixed in the instrument's firmware).

It has additional support for device management (you can check if it's really our electronic load, you can reset it) and it supports LabVIEW device error management.

 

Initialize component

image

Here is the internal flow of that Initialize component:

I'll break this down into the lower levels. Note that each block that has a selector (the little rectangle in the middle of the top bar of a block) represents multiple flows.

The image just shows one of the possible ones (e.g. for the first block, it shows the process if the option to validate the instrument's IDN is set to True).

You expose the in and out parameters on the block's icon:

image

 

image

The elements that don't have a spot on the icon are private to the block. You can't set them from external.

For the Initialize block, the input parameters are

  • VISA resource name eload
  • delay before read (ms)
  • ID Query (T/F)
  • Reset (T/F)
  • eror in (no error)

The output parameters are

  • VISA resource name out
  • error out

After running this block, the following functionality is performed:

  • The VISA device that you pass to this block (it's serial so this will always be a COM port) will be opened, using the internal Serial settings of the block.
  • If ID Query is set to True, the block will compare the instrument's ID string with "THEBREADBOARD,ELECTRONICLOAD".
    If the instrument's string doesn't start with this string, the block will throw an error:
    -1074003951: The ID Query failed.  This may mean that you selected the wrong instrument or your instrument did not respond. 
    You may also be using a model that is not officially supported by this driver.
    If you are sure that you have selected the correct instrument and it is responding, try disabling the ID Query.
  • If Reset is true, the block will execute the Reset block (this custom block will be discussed later). This will shoot a *RST SCPI command to the device.
    Else it calls the Default block (also discussed later). That one sends a *CLS command.
  • If an error is detected, the VISA resource is closed and error info is passed to the caller.
    Else the block passes the initiated device back to the calling flow.

 

Initialising the VISA resource

 

image

The first step in the block is to retrieve the VISA resource from the calling flow. You can also pass it the error stack from previous processes.

It will then initiate communication with the device, using the serial settings defined within this block (9600, 8, 1, N).

 

Query the Identifier

 

image

The image shows the two possible flows.

The first one is executed if you pass True for ID Query. The second one (that does nothing) when you pass False.

An *IDN? command is sent via the lower level VISA Serial block that comes with LabVIEW, the block waits 500 ms (passed via delay before read (ms)),  reads the SCPI reply from the instrument and checks if the identifier starts with our check string.

If there's a match, this block doesn't touch the error info. If the identifier is not ok, we push an eror message on the stack and set the status to error.

It then hands over control to the next block.

 

Reset

 

 

image

Here are again two possibilities.

If you pass True to the Reset (True) signal, the flow calls the custom Default Instrument Setup block.

If you pass False to the Reset (True) signal, the flow calls the custom Reset block.

These two blocks are part of the library that we're building here and will be siscussed later.

 

Error

 

image

Also two possibilities. If the previous actions were successful, the block does nothing.

Else it closes the VISA resource and clears the VISA resource name out parameter.

Then control is handed back to the calling flow.

 

LABView blocks
LabVIEW Library part 1: Initialise Block
LabVIEW Library part 2: Read Output Block
LabVIEW Library part 3: Close Block
LabVIEW Library part 4: Function Set Block
LabVIEW Library part 5: Input Control Block
LabVIEW Library part 6: Raw DAC Block
LabVIEW Library part 7: Raw ADC Block
Real World Examples
Programmable Electronic Load - Automating a DC Switcher Efficiency Test with LabVIEW
  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 5 years ago +1
    LabVIEW announced a 2020 community edition. I'm applying for the beta program ...
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to Jan Cumps +1
    Yes !!!
  • jc2048
    jc2048 over 5 years ago in reply to Jan Cumps

    That's great. Keep us all posted on your progress with it.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 5 years ago in reply to Jan Cumps

    Yes  !!!

     

    image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 5 years ago

    LabVIEW announced a 2020 community edition. I'm applying for the beta program ...

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 6 years ago in reply to s8548a

    s8548a  wrote:

     

    ....

    Can simulink use instead of LabView?

    I don’t know. I have no simulink experience.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • s8548a
    s8548a over 6 years ago

    Thank you very much.

    I was about to ask how to access a generic SCPI device from VISA-hmm serial tool box.

    Can simulink use instead of LabView?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • 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 © 2025 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

  • X
  • Facebook
  • linkedin
  • YouTube