feat: diode, math (stats), dBm, temp, restore mode
Add diode mode, math (min/max/avg), temp - k type thermocouple and thermistor (only 5k tho..), restore mode to the one we came from when exiting feature. Add all features to USB-CDC interface, clean up state a bit (union)
This commit is contained in:
2
ch32fun
2
ch32fun
Submodule ch32fun updated: 4679e076f0...c40a0d52d4
@@ -62,6 +62,92 @@
|
||||
#define GPIB_TAG_BASE 0x40 // Talk Address Group base
|
||||
#define GPIB_SCG_BASE 0x60 // Secondary Command Group base
|
||||
|
||||
/* HP3478A */
|
||||
// Measurement Function (F)
|
||||
#define HP3478A_FUNC_DC_VOLTS "F1"
|
||||
#define HP3478A_FUNC_AC_VOLTS "F2"
|
||||
#define HP3478A_FUNC_OHMS_2WIRE "F3"
|
||||
#define HP3478A_FUNC_OHMS_4WIRE "F4"
|
||||
#define HP3478A_FUNC_DC_CURRENT "F5"
|
||||
#define HP3478A_FUNC_AC_CURRENT "F6"
|
||||
#define HP3478A_FUNC_OHMS_EXT "F7"
|
||||
|
||||
// Range (R)
|
||||
#define HP3478A_RANGE_NEG_2 "R-2" /* 30mV DC */
|
||||
#define HP3478A_RANGE_NEG_1 "R-1" /* 300mV (AC/DC) or 300mA (AC/DC) */
|
||||
#define HP3478A_RANGE_0 "R0" /* 3V (AC/DC) or 3A (AC/DC) */
|
||||
#define HP3478A_RANGE_1 "R1" /* 30V (AC/DC) or 30 Ohm */
|
||||
#define HP3478A_RANGE_2 "R2" /* 300V (AC/DC) or 300 Ohm */
|
||||
#define HP3478A_RANGE_3 "R3" /* 3K Ohm */
|
||||
#define HP3478A_RANGE_4 "R4" /* 30K Ohm */
|
||||
#define HP3478A_RANGE_5 "R5" /* 300K Ohm */
|
||||
#define HP3478A_RANGE_6 "R6" /* 3M Ohm */
|
||||
#define HP3478A_RANGE_7 "R7" /* 30M Ohm */
|
||||
#define HP3478A_RANGE_AUTO "RA" /* Autorange */
|
||||
|
||||
// Display / Integration Time (N)
|
||||
#define HP3478A_DIGITS_3_5 "N3" /* 3 1/2 digit (Fastest) */
|
||||
#define HP3478A_DIGITS_4_5 "N4" /* 4 1/2 digit (1 PLC integration) */
|
||||
#define HP3478A_DIGITS_5_5 "N5" /* 5 1/2 digit (Best noise rejection) */
|
||||
|
||||
// Trigger (T)
|
||||
#define HP3478A_TRIG_INTERNAL "T1" /* Internal trigger */
|
||||
#define HP3478A_TRIG_EXTERNAL "T2" /* External trigger pulse */
|
||||
#define HP3478A_TRIG_SINGLE "T3" /* Single trigger (Software/GET) */
|
||||
#define HP3478A_TRIG_HOLD "T4" /* Trigger Hold (Idle) */
|
||||
#define HP3478A_TRIG_FAST "T5" /* Fast Trigger (No settling delay) */
|
||||
|
||||
// Autozero (Z)
|
||||
#define HP3478A_AUTOZERO_OFF "Z0"
|
||||
#define HP3478A_AUTOZERO_ON "Z1"
|
||||
|
||||
// Write to Display (D)
|
||||
#define HP3478A_DISP_NORMAL "D1" /* Return to normal measurement display */
|
||||
#define HP3478A_DISP_TEXT "D2" /* Prefix: Follow with up to 12 chars */
|
||||
#define HP3478A_DISP_TEXT_FAST \
|
||||
"D3" /* Like D2, but stops updating (faster read rate) */
|
||||
|
||||
// Preset Commands (H)
|
||||
#define HP3478A_PRESET_HOME "H0"
|
||||
#define HP3478A_MEAS_DC_VOLTS "H1"
|
||||
#define HP3478A_MEAS_AC_VOLTS "H2"
|
||||
#define HP3478A_MEAS_OHMS_2WIRE "H3"
|
||||
#define HP3478A_MEAS_OHMS_4WIRE "H4"
|
||||
#define HP3478A_MEAS_DC_CURRENT "H5"
|
||||
#define HP3478A_MEAS_AC_CURRENT "H6"
|
||||
#define HP3478A_MEAS_OHMS_EXT "H7"
|
||||
|
||||
#define HP3478A_CMD_STATUS_BYTE "B"
|
||||
|
||||
// Serial Poll Register (K)
|
||||
#define HP3478A_CMD_SRQ_CLEAR "K"
|
||||
|
||||
// Error Register (E)
|
||||
#define HP3478A_CMD_ERR_READ "E"
|
||||
|
||||
// Front/Rear Switch (S)
|
||||
#define HP3478A_CMD_SWITCH_READ "S"
|
||||
|
||||
// SRQ Mask (M)
|
||||
#define HP3478A_CMD_SRQ_MASK_PFX "M"
|
||||
|
||||
#define HP3478A_MASK_DATA_READY 0x01 /* Bit 0: Reading available to bus */
|
||||
#define HP3478A_MASK_UNUSED_B1 0x02 /* Bit 1: Not used */
|
||||
#define HP3478A_MASK_SYNTAX_ERR 0x04 /* Bit 2: Syntax error */
|
||||
#define HP3478A_MASK_HARDWARE_ERR 0x08 /* Bit 3: Hardware error */
|
||||
#define HP3478A_MASK_KEYBOARD_SRQ \
|
||||
0x10 /* Bit 4: Front panel 'SRQ' key pressed */
|
||||
#define HP3478A_MASK_CAL_FAIL 0x20 /* Bit 5: Calibration procedure failed */
|
||||
#define HP3478A_MASK_ZERO_B6 0x40 /* Bit 6: Always zero */
|
||||
#define HP3478A_MASK_POWER_ON 0x80 /* Bit 7: PON Switched/Device Clear */
|
||||
|
||||
// "M20" -> SRQ on Button Only
|
||||
#define HP3478A_CMD_MASK_BTN_ONLY "M20"
|
||||
// "M21" -> SRQ on Button OR Data Ready
|
||||
#define HP3478A_CMD_MASK_BTN_DATA "M21"
|
||||
// "M00" -> Clear Mask (Disable SRQ)
|
||||
#define HP3478A_CMD_MASK_CLEAR "M00"
|
||||
|
||||
#define GPIB_ASSERT(pin) funDigitalWrite(pin, 0)
|
||||
#define GPIB_RELEASE(pin) funDigitalWrite(pin, 1)
|
||||
#define GPIB_READ(pin) funDigitalRead(pin)
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
#define FUSB_USB_VID 0x1209
|
||||
#define FUSB_USB_PID 0x3478
|
||||
#define FUSB_USB_REV 0x0100
|
||||
#define FUSB_USB_REV 0x0110
|
||||
#define FUSB_STR_MANUFACTURER u"Open Source GPIB"
|
||||
#define FUSB_STR_PRODUCT u"HP3478A Internal Adapter"
|
||||
#define FUSB_STR_SERIAL u"3478A-USB-001"
|
||||
#define FUSB_STR_SERIAL u"3478A-USB-110"
|
||||
|
||||
//Taken from http://www.usbmadesimple.co.uk/ums_ms_desc_dev.htm
|
||||
static const uint8_t device_descriptor[] = {
|
||||
|
||||
Reference in New Issue
Block a user