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. |
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
Implement real Instrument Specific Registers
The first post ended when I had created empty definitions for the registers and related infratructure:
#define USER_REGISTERS #define USER_REGISTER_GROUPS #define USER_REGISTER_DETAILS #define USER_REGISTER_GROUP_DETAILS
Now I'm building the whole configuration to capture device settings and events, and promote them up the hierarchy:
scpi_user_config.h
#ifndef _SCPI_USER_CONFIG_H #define _SCPI_USER_CONFIG_H // define instrument specific registers #define USE_CUSTOM_REGISTERS 1 #define USER_REGISTERS \ USER_REG_DIGINEVENT, /* Digital In event status Register */ \ USER_REG_DIGINEVENTE, /* Digital In event status enable Register */ \ USER_REG_DIGINEVENTC, /* Digital In event status condition Register */ \ USER_REG_DIGINEVENTP, /* Digital In event status positive filter Register */ \ USER_REG_DIGINEVENTN, /* Digital In event status negative register Register */ #define USER_REGISTER_GROUPS \ USER_REG_GROUP_DIGINEVENT, #define USER_REGISTER_DETAILS \ { SCPI_REG_CLASS_EVEN, USER_REG_GROUP_DIGINEVENT }, \ { SCPI_REG_CLASS_ENAB, USER_REG_GROUP_DIGINEVENT }, \ { SCPI_REG_CLASS_COND, USER_REG_GROUP_DIGINEVENT }, \ { SCPI_REG_CLASS_PTR, USER_REG_GROUP_DIGINEVENT }, \ { SCPI_REG_CLASS_NTR, USER_REG_GROUP_DIGINEVENT }, #define USER_REGISTER_GROUP_DETAILS \ { \ USER_REG_DIGINEVENT, \ USER_REG_DIGINEVENTE, \ USER_REG_DIGINEVENTC, \ USER_REG_DIGINEVENTP, \ USER_REG_DIGINEVENTN, \ SCPI_REG_OPER, \ 1 /* TODO this defines to what bit of the parent we trickle through */ \ }, /* USER_REG_GROUP_DIGINEVENT */ #endif // _SCPI_USER_CONFIG_H
I designed a user condition, event and enable register, with the OPERATION STATUS register as parent.
- I can change values in the condition register.
- the value trickles and latches in the corresponding bit in the event register
- the value trickles down to a bit of my choice in the OPERATION STATUS register (also latched)
That means that I can listen to GPIO, and set a condition register bit. Library infra will manage the latching and clearing
I designed 2 additional registers to indicate if I want to listen to positive and/or negative transitions. The latching will only apply if the transition is requested to be monitored.
All is handled by the lib. It seems that I only have to define the user registers, configure the behaviour. And that results in changes in the standard OPERATION STATUS register.
Existing SCPI commands in the lib can take care that these trickle down further to standard OPERATION bit of the STATUS BYTE register