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 PST.. Experimental event / trigger support for Pico SCPI labTool - 3: Instrument Specific Registers Test
  • 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: 22 Sep 2023 2:12 PM Date Created
  • Views 726 views
  • Likes 6 likes
  • Comments 2 comments
  • pico_usbtmc_scpi
  • pico
  • pico_eurocard
  • USBTMC
  • Pico SCPI labTool
  • labview
  • scpi
Related
Recommended

PST.. Experimental event / trigger support for Pico SCPI labTool - 3: Instrument Specific Registers Test

Jan Cumps
Jan Cumps
22 Sep 2023
PST.. Experimental event / trigger support for Pico SCPI labTool - 3: Instrument Specific Registers Test

The Pico SCPI labTool (PST) allows you to connect your PC to equipment to control and monitor all sorts of things. It runs on a Raspberry Pico. It would be nice if the PST could supports device dependent SCPI registers. They can be used to notify a LabVIEW flow from the device. I'd be happy if we can notify LabVIEW when a GPIO input changed logic level.
In this post: I test instrument dependent registers, their SCPI commands, and if they can propagate to the standard SCPI registers.

image

Thank you Gough Lui for validating the design.

part 1: PST.. Experimental event / trigger support for Pico SCPI labTool - 1: investigate 
part 2: PST.. Experimental event / trigger support for Pico SCPI labTool - 2: design the registers 
part 3: PST.. Experimental event / trigger support for Pico SCPI labTool - 3: Instrument Specific Registers Test
part 4: PST.. Experimental event / trigger support for Pico SCPI labTool - 4: let TinyUSB USBTMC code use SCPI-LIB's Status Byte register 
part 5:  PST.. Experimental event / trigger support for Pico SCPI labTool - 5: Propagation to IEEE488.2 SCPI Registers Test 
part 6: PST.. Experimental event / trigger support for Pico SCPI labTool - 6: Service Request from Instrument to LabVIEW flow 
part 7: PST.. Experimental event / trigger support for Pico SCPI labTool - 7: Test Service Request from Instrument to LabVIEW flow 

Test Setup

I connected a push button to PST Digital In PIN 2 (GPIO27). That is the user button of shabaz' Pico Euroard. It pulls the pin low when pressed. I added a 10K pull-up resistor.

if you use push buttons or other mechanical contacts (relays, contactors) on an input pin, you should add a hardware debounce circuit, and a pull-up. The PST (intentionally!) does not use the internal Pico pull-up capability or a software debounce algorithm.

image

As software test bed, I use NI VISA Interactive Control. The application allows me to easily submit SCPI commands, and can test the STB register and service requests.

image

Test scenario will systematically check

  • if a change in status of the Digital Pin 2 (button push) has the desired effect on registers.
  • does filtering work?
  • can I propagate an event to the Operation Status register?

image

Test Instrument Specific Registers

test 1: DIGITAL IN CONDITION register

condition:

  1. If the user button is released, DIGI IN PIN2 is 1. Bit 2 of the DIGITAL IN CONDITION register must be 1
  2. If the user button is pressed, DIGI IN PIN2 is 0. Bit 2 of the DIGITAL IN CONDITION register must be 0

result;

1: button released

STATus:OPERation:DIGItal:INPut:CONDition?
4

2: button pressed

STATus:OPERation:DIGItal:INPut:CONDition?
0

pass

test 2: DIGITAL IN TRANSITION filters and DIGITAL IN EVENT register

condition:

  1. DIGITAL IN EVENT register Bit 2 should be 0
  2. If the user button is pressed or released, DIGITAL IN EVENT register Bit 2 should stay 0
  3. set DIGITAL IN NEGATIVE TRANSITION register Bit 2, validate if it is set
  4. DIGITAL IN EVENT register Bit 2 should stay 0
  5. Press the user button and release it. DIGITAL IN EVENT register Bit 2 should be 1
  6. Read Clear test: Query should clear the register. DIGITAL IN EVENT register Bit 2 should be 0.

result:

1: query initial state:

STATus:OPERation:DIGItal:INPut:EVENt?
0

2: push and release button, state should not alter because filter condition not met:

STATus:OPERation:DIGItal:INPut:EVENt?
0

3: enable negative transition bit 2, and query the register to see if it is set:

STATus:OPERation:DIGItal:INPut:NTRansition 4
STATus:OPERation:DIGItal:INPut:NTRansition?
4

4: query state again. Should be 0 because filter  condition not met:

STATus:OPERation:DIGItal:INPut:EVENt?
0

5: push and release button, Should report that Bit 2 is 1 because filter condition (transition from 1 to 0) met:

STATus:OPERation:DIGItal:INPut:EVENt?
4

6: Query again. Should report that Bit 2 is 0 because a query clears the register:

STATus:OPERation:DIGItal:INPut:EVENt?
0

test 3: DIGITAL IN ENABLE register and propagation to IEEE488.2 OPERATION STATUS register

This is the handover from instrument specific register (PST registers)  to the IEEE488.2 / SCPI standard registers. Can an event  propagate to the OPERATION STATUS register, if enabled?
Propagation rule for DIGITAL IN: for enabled bits, the event register summary should propagate to OPERATION STATUS register Bit 0.

condition:

  1. By default, our exercise should not propagate. All previous tests should have been contained in the DIGITAL IN registers. OPERATION STATUS register Bit 1 should be 0
  2. set DIGITAL IN ENABLE register Bit 2 to 1 and read it back
  3. Query OPERATION STATUS register again. Bit 0 should still be 0.
  4. Press and release the user button. OPERATION STATUS register Bit 0 should stay 1
  5. Read Clear test: Query should clear the register. OPERATION STATUS register Bit 0 should be 0.

result:

1: query initial state:

STATus:OPERation:EVENt?
0

2: Enable propagation to OPERATION STATUS register by setting bit 2 of the DIGITAL IN ENABLE register to 1. Check if it is set:

STATus:OPERation:DIGItal:INPut:ENABle 4
STATus:OPERation:DIGItal:INPut:ENABle?
4

3: OPERATION STATUS register Bit 0 should still be 0, because we haven't generated an event yet after enabling the propagation:

STATus:OPERation:EVENt?
0

4: Press and release the button. This generates a negative transition, and should now propagate. Query if the OPERATION STATUS register Bit 0 is 1.

STATus:OPERation:EVENt?
1

5: Query if the OPERATION STATUS register read has cleared the register. Bit 0 should be 0.

STATus:OPERation:EVENt?
0

pass

image

Minimal SCPI commands to make a negative transition trickle through:

# set filter neg trans pin2
STATus:OPERation:DIGItal:INPut:NTRansition 4\n

# enable propagation pin2
STATus:OPERation:DIGItal:INPut:ENABle 4\n

Can be tested with

STATus:OPERation:EVENt?\n

To make the fan-out work again, the event registers have to be reset.
Either by reading them, or by submitting the *CLS (clear Status) SCPI command.

link to all posts

  • Sign in to reply
  • DAB
    DAB over 1 year ago

    Nice update Jan.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 1 year ago

    Scrapbook (for later reference)

    STATus:OPERation:DIGItal:INPut:CONDition?\n
    STATus:OPERation:DIGItal:INPut:EVENt?\n
    
    STATus:OPERation:DIGItal:INPut:NTRansition 4\n
    STATus:OPERation:DIGItal:INPut:ENABle 4\n
    
    STATus:OPERation:DIGItal:INPut:ENABle 4\n
    STATus:OPERation:DIGItal:INPut:ENABle?\n
    
    STATus:OPERation:DIGItal:INPut:NTRansition 4\n
    STATus:OPERation:DIGItal:INPut:NTRansition?\n
    
    STATus:OPERation:CONDition?\n
    STATus:OPERation:EVENt?\n
    
    STATus:OPERation:EVENt?\n
    
    *CLS\n
    
    SYST:ERR:COUN?\n
    SYST:ERR?\n
    

    These are the commands I used, with right termination for the NI Visa tool

    • 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