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
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Create a Programmable Instrument with SCPI - Part 6: LabVIEW Integration
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 27 Sep 2016 12:04 PM Date Created
  • Views 5176 views
  • Likes 3 likes
  • Comments 0 comments
  • metrology
  • smart_instrument
  • pwm
  • gpib
  • labview
  • scpi
  • hercules
  • launchpad
Related
Recommended

Create a Programmable Instrument with SCPI - Part 6: LabVIEW Integration

Jan Cumps
Jan Cumps
27 Sep 2016
For a hardware evaluation project I'm working on, I want to create a device that can be controlled via LabVIEW.
LabVIEW can talk to instruments using serial out of the box, and it knows how to talk Standard Commands for Programmable Instruments (SCPI).

 

image

 

In this blog I make a LabVIEW Virtual Instrument that turns PWM signals on and off.

 

 

LabVIEW Design

We'll create a LabVIEW control panel that can toggle PWM output of a Hercules microcontroller.

In the previous blogs we enabled our Hercules LaunchPad USB and made firmware that knows how to interpret SCPI.

Our LabVIEW program has to be able to connect to our USB port and send SCPI commands.

We'll use a toggle button to switch PWM on and off.

 

Requirements of the LabVIEW design:

  • connect to a COM port and talk serial
  • Send the right SCPI commands to the COM port, depending on the position of the toggle switch.

 

There's an example program in LabVIEW that gets us 70% of what we need: examples\Instrument IO\Serial\Simple Serial.vi.

That one can connect to our LaunchPad over USB and send the SCPI command *IDN? (we've used this program earlier on in our tests).

We can use the complete program - we just need to replace the constant string '*IDN?' with either PWM1:STATe ON or PWM1:STATe OFF depending on the state of our toggle switch.

 

That isn't hard. The first thing we do is place a boolean control on our canvas. I selected a switch that gives a good indication of On/Off. I named it PWM.

image

 

Then, in the Block Diagram,I added a Case block, and wired the switch to that.

I also added two constant string items, one containing PWM1:STATe ON,the other PWM1:STATe OFF.

I wired the two strings to the case statement as inputs. The output of the case statement is routed to where the original *IDN? data was flowing.

 

image

 

 

In the case block, for the False state, I routed the OFF input to the output. For the True state, I routed the ON input. And that's it.

To test the program, set the toggle in the desired position and run your LabVIEW program.

The PWM output will switch on or off based on that.

 

 

 

I've attached the LabVIEW project to this blog. The firmware for the Hercules LaunchPad is available in the previous one.

Give it a try!

 

Related Blog

Create a Programmable Instrument with SCPI - Part 1: Parser Library
Create a Programmable Instrument with SCPI - Part 2: Serial over USB
Create a Programmable Instrument with SCPI - Part 3: First Conversation *IDN?
Create a Programmable Instrument with SCPI - Part 4: Error Handling by Default
Create a Programmable Instrument with SCPI - Part 5: First Hardware Commands
Create a Programmable Instrument with SCPI - Part 6: LabVIEW Integration
Create a Programmable Instrument with SCPI - Part 7: Talk to Hardware Registers
Attachments:
Hercules SCPI.zip
  • Sign in to reply
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