; TestController device configuration file for the wrytech PDVS 2 Mini v2, firmware v2.0x.
; Version: 1.1
; Date: 23-06-2026
; Written by Gertjan Miedema,  info at miedemageluid dot nl,  Username "Gertjan" at EEVblog.

; For use with TestController, software to control and log data.
; Tested with wrytech PDVS 2 Mini v2, firmware 2.01, using the Wrytech IUSL Isolated USB Serial Link interface.

; TestController must be restarted before any changes in this file will be used.
; TestController Manual is here: https://lygte-info.dk/project/TestControllerConfigDevice%20UK.html


; Some info & tips:
;
; - Set TestController and PDVS 2 Mini v2 to the same baud rate.
;   Suggested is 115200 baud, N81, no handshake.
;
; - The wrytech IUSL Isolated USB Serial Link does not need a driver for Windows 10 & 11.
;   For Windows XP, 7 and 8 an INF file is needed. Look for "Holtec HT42B534-x USB Bridge Setup".
;
; - The Status info in the Setup Menu is auto-refreshed every 7 seconds.


; Known issues:
;
; - This device driver works ONLY for the PDVS 2 mini v2, firmware v2.0 or 2.01.
;   Because this driver is using the previous generation serial commands, used before firmware v.26
;
; - Use for PDVS 2 Mini v2 with firmware v2.26 or higher the other device driver: "wrytech PDVS 2 Mini v2.26 up"
;   That driver is using the new SCPI commands introduced in v2.26.
;
;   Even older PDVS 2 Mini's (pre v2) are using earlier, different serial commands,
;   and will not work with either driver.
;   However, it will be easy to adapt this configuration file to those earlier commands.





#idString Wrytech,PDVS2miniV2,
#name wrytech PDVS 2 Mini v2
#handle PDVS2

#port com
#driver Ascii


; 20ms delay for each command. To have enough time to process the multi-line answers.
#cmdDelayTime 20
 

; The author statement is used for the listing in the About window.
#author Gertjan Miedema


#notes  
- Device configuration file for the wrytech PDVS 2 Mini v2, firmware v2.0 or 2.01.
  This driver is using the previous generation serial commands, used before firmware v.26

- Use for PDVS 2 Mini v2 with firmware v2.26 or higher the other device driver: "wrytech PDVS 2 Mini v2.26 up"
  That driver is using the new SCPI commands introduced in v2.26.

- Set TestController and PDVS 2 Mini v2 to the same baud rate.
  Suggested is 115200 baud, N81, no handshake.

- The wrytech IUSL Isolated USB Serial Link does not need a driver for Windows 10 & 11.
  For Windows XP, 7 and 8 an INF file is needed. Look for "Holtec HT42B534-x USB Bridge Setup".

- For more info, tips and known issues, see the notes in the header of the device configuration file (wrytechPDVS2miniV2.txt).


Configuration file version: 1.1



; ============== Original PDVS 2 Mini v2 commands to SCPI/TestController commands translations  ==============

; There must be a line for each of the original device commands that will be used, converting it to a similar SCPI command



; -----  Instrument identification   ------

; Command to check if an PDVS 2 Mini is online.
; The PDVS 2 Mini does not have an identification command like *IDN?
; The first to words of the <status> answer are used to check if a PDVS 2 mini v2 is online.
; This command returns the first part of the <Status> answer string: "Output Voltage".

#scpiCmd checkID? txrxn? 4 <Status>
:string:
:readmath: getElement(value,0,"[\n]");
:readmath: getElement(value,0,"[:]")


; Command to read the Serial Number.

#scpiCmd getDeviceSN?  txrxn? 25 <ShowFactoryCal>
:string:
:readmath: getElement(value,24,"[\n]");
:readmath: trim(getElement(value,1,"[:]"))



; -----  Set output  -----

; Command to set output Voltage.
; for PDVS 2 Mini v2: <KeyVoltage,1.23456> : Set Output voltage to 1.23456V.

#scpiCmd setVolt tx <KeyVoltage,(value)>


; Command for older PDVS2 mini (pre V2).
; for older PDVS 2 Mini: <KeyVoltage,0,1.23456> : Set Output voltage to 1.23456V.

; #scpiCmd setVolt tx <KeyVoltage,0,(value)>




; -----  Data read out  -----

; Command to read current Volt setting.

#scpiCmd readVolt? txrxn? 4 <Status>
:readmath: getElement(value,0,"[\n]");
:readmath: getElement(value,1,"[:]")


; Command to read current Internal Temperature.

#scpiCmd readTemp? txrxn? 4 <Status>
:readmath: getElement(value,3,"[\n]");
:readmath: getElement(value,1,"[:]")


; Command to read current Battery voltage.

#scpiCmd readBatt? txrxn? 4 <Status>
:readmath: getElement(value,2,"[\n]");
:readmath: getElement(value,2,"[:]")


; Command to read current Power Status (External DC or Battery and Voltage).

#scpiCmd readPWRstatus? txrxn? 4 <Status>
:string:;
:readmath: getElement(value,2,"[\n]");
:readmath: substring(trim(value),13)


; Command to read current Output Status (OK or Error and Set Voltage).

#scpiCmd readOUTstatus? txrxn? 4 <Status>
:string:;
:readmath: getElement(value,1,"[\n]");
:readmath: substring(trim(value),14)


; ==============  End command conversion PDVS 2 Mini v2 -> SCPI/TestController  ==============





; ---------- Read-Out commands ---------


; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6).
; Format: #value ColumnName Unit Format

#value Volt V D5
#value Int.Temp grC D1
#value Batt V D1



; How to poll for data, this is used for table and #values?
; Answer from device is: value mode

#askValues readVolt?;readTemp?;readBatt?
#askValuesReadFormat fxfxfx




; set output to null volt

#outputOff setVolt 0




; Command to prevent connection to other devices.
; The PDVS 2 Mini does not have an identification command like *IDN?.
; The first to words of the <status> answer are used to check if a PDVS 2 Mini v2 is online.

#verifyDevice "Output Voltage" checkID?






; --------------------  Setup Menu  --------------------

#cmdSetup number Output_Volt
:read:  readVolt?
:readmath: getElement(value,0,"[ ]")
:write: setVolt #
:update: Internal_Temp.,Battery,Power_Status,Output_Status
:tip: Set output Volage. Up to 5 decimals.
V 0 10.22222


#cmdSetup separator Output_Volt
2 100 Empty

#cmdSetup separator Output_Volt
2 100 Raised
center Status info


#cmdSetup info Internal_Temp.
:read: readTemp?
:readmath: getElement(value,0,"[ ]")
degr.C
_


#cmdSetup info Battery
:read: readBatt?
:readmath: getElement(value,0,"[ ]")
V
_


#cmdSetup info Power_Status
:read: readPWRstatus?
_
_


#cmdSetup info Output_Status
:read: readOUTstatus?
_
_


; Auto-update the info controls every 7 seconds.
#cmdSetup Updater update
:update: Internal Temp.,Battery,Power_Status,Output_Status
7

