element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 Sound and Vibration Measurement: Instrument Network Service for LabVIEW Pt6: Build the Services from source on the Pi (or BB)
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Test & Tools requires membership for participation - click to join
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 19 Apr 2022 2:12 PM Date Created
  • Views 792 views
  • Likes 5 likes
  • Comments 0 comments
  • RoadTest
  • mcc172
  • labview
  • scpi
Related
Recommended

Sound and Vibration Measurement: Instrument Network Service for LabVIEW Pt6: Build the Services from source on the Pi (or BB)

Jan Cumps
Jan Cumps
19 Apr 2022

A little post to support building the sources on a Pi, from command line.
If you prefer to use precompiled binaries, they are available on github)

I'm developing the software on a Windows PC, with Eclipse and a cross compiler. As you can see below, it can be compiled native on the Pi too.

The 3 executables are:

  1. Instrument Service
  2. Dummy Instrument Service
  3. SCPI Service

For the instrument service, choose #2 if you don't have a hat, or want to experiment. Choose #1 if you have a MCC172 hat and want to automate it.
Choose #3 if you want to have SCPI compatibility. Required if you're working with the LabVIEW driver

image

Preparation:

get boost libraries:

sudo apt-get install libboost-all-dev

Create a directory for this project

(any directory will do)

mkdir ~/daqhats

Get the source

cd ~/daqhats
git clone https://github.com/jancumps/daqhats_scpi_service.git

Build Dummy Instrument Service.

This is the option you choose when you don't have a DAQ hat but want to evaluate the LabVIEW driver. It emulates the instrument.

Build

cd ~/daqhats
cd daqhats_scpi_service
cd daqhats_dummy_service
# compile
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src/main.o" "src/main.cpp"
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src/DaqHatInstrument.o" "src/DaqHatInstrument.cpp"
#link
g++ -o daqhats_dummy_service "src/DaqHatInstrument.o" "src/main.o" -lpthread -lboost_system -lboost_chrono
#make executable
chmod +x  ./daqhats_dummy_service

Execute:

~/daqhats/daqhats_scpi_service/daqhats_dummy_service/daqhats_dummy_service 2501 2502 0

Build Real Instrument Service

This is the option you choose when you have a DAQ hat. No emulation, the real service.

Prerequisite: the supplier's software is installed as instructed on the GitHub page.

Build

cd ~/daqhats
cd daqhats_scpi_service
cd daqhats_service
#compile
g++ -std=c++2a -O0 -g3 -Wall -c -fmessage-length=0 -o "src/DaqHatInstrument.o" "src/DaqHatInstrument.cpp"
g++ -std=c++2a -O0 -g3 -Wall -c -fmessage-length=0 -o "src/main.o" "src/main.cpp"
#link
g++ -o daqhats_service "src/DaqHatInstrument.o" "src/main.o" -ldaqhats -lpthread -lboost_system -lboost_chrono
#make executable
chmod +x  ./daqhats_service

Execute:

~/daqhats/daqhats_scpi_service/daqhats_service 2501 2502 0

Build SCPI Service

This is required if you want to control the instrument (or dummy) via LabVIEW or other SCPI client.

Get SCPI lib and copy files to project

cd ~/daqhats
git clone https://github.com/j123b567/scpi-parser.git
cd daqhats_scpi_service

cd daqhats_scpi_socket
cd src/scpi
cp -r ../../../../scpi-parser/libscpi/src/* .
cd ../../inc/scpi
cp -r ../../../../scpi-parser/libscpi/inc/scpi/* .

Build

cd ~/daqhats
cd daqhats_scpi_service
cd daqhats_scpi_socket
#compile
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/scpi/utils.o" "src/scpi/utils.c"
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/scpi-def.o" "src/scpi-def.c"
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/scpi/parser.o" "src/scpi/parser.c"
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/scpi/error.o" "src/scpi/error.c"
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/scpi/minimal.o" "src/scpi/minimal.c"
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/linux_scpi_socket.o" "src/linux_scpi_socket.c"
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/scpi/expression.o" "src/scpi/expression.c"
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/scpi/fifo.o" "src/scpi/fifo.c"
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/scpi/lexer.o" "src/scpi/lexer.c"
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/scpi/units.o" "src/scpi/units.c"
gcc -I "./inc" -O0 -g3 -Wall -c -fmessage-length=0 -o "src/scpi/ieee488.o" "src/scpi/ieee488.c"
#link
g++ -o daqhats_scpi_socket "src/linux_scpi_socket.o" "src/scpi/error.o" "src/scpi/expression.o" "src/scpi/fifo.o" "src/scpi/ieee488.o" "src/scpi/lexer.o" "src/scpi/minimal.o" "src/scpi/parser.o" "src/scpi/units.o" "src/scpi/utils.o" "src/scpi-def.o"

#make executable
chmod +x  ./daqhats_scpi_socket

Execute:

~/daqhats/daqhats_scpi_service/daqhats_scpi_socket/daqhats_scpi_socket 2500 2501

Link to all posts.



  • 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