Skip to content

huangdong332/ITECH_DC_POWER_CAPL_DLL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Project logo

ITECH DC Power Control CAPL DLL

Status GitHub Issues GitHub Pull Requests License


A CAPL DLL to control an ITECH DC power.

📝 Table of Contents

🧐 About

This CAPL dll provides interfaces to control an ITECH programmable DC power supply through USB in CAPL. The only two APIs(dllItechDcPowerWrite & dllItechDcPowerQuery) in this dll are implemented on top of VISA(Virtual instrument software architecture). The standard SCPI command can be send to an ITECH device through those two APIs by the way controlling this device. The supported SCPI commands can be found in the device's document normally named "One's programming guide".

Communication Interface

USB and RS232 are both supported now.

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

MinGW and Make.

This CAPL dll is built with a MinGW gcc tools for 32bit Windows target. The 64bit CAPL dll can't be recognized by the CAPL browser any way. The compile process is managed by a Makefile.

I use msys64 to install MinGW and Make.

Instrument Driver

NIVISA and NIIPC driver package should be installed on your machine.

🎈 Usage

There is an example code in CAPL. In this test case, a ITECH DC power supply's voltage is set to 5V.After 5 seconds,its output is truned ON. After 5 seconds, its voltage is adjusted to 10V. After 5 seconds, its voltage and current are queried and its voltage is adjusted to 800mV. After 5 seconds, its output is turned off.

USB

testcase TurnOnAndOff()
{
  char resultString[100];
  float result;
  //Set output voltage to 5V.
  dllItechDcPowerWrite("VOLT 5V");
  testWaitForTimeout(5000);
  //Set output state to  ON.
  dllItechDcPowerWrite("OUTP 1");
  testWaitForTimeout(5000);
  dllItechDcPowerWrite("VOLT 10V");
  testWaitForTimeout(5000);
  //Measure output voltage, numberic result saved in "result".
  dllItechDcPowerQuery("MEAS:VOLT?",resultString,result);
  write("Measured voltage: %f",result);
  //Measure output current, numberic result saved in "result".
  dllItechDcPowerQuery("MEAS:CURR?",resultString,result);
  write("Measured current: %f",result);
  dllItechDcPowerWrite("VOLT 800mV");
  testWaitForTimeout(5000);
  //Set output state to  OFF.
  dllItechDcPowerWrite("OUTP 0");
  
}

RS232

testcase test()
 {
  char resultString[100];
  float result;
  //!!!IMPORTANT!!!
  //Must be the first step in case of RS232.
  //This SCPI command enables reomte control.
  dllItechDcPowerWriteSerial("SYST:REM");
  dllItechDcPowerWriteSerial("VOLT 5V");
  testWaitForTimeout(5000);
  dllItechDcPowerWriteSerial("OUTP 1");
  testWaitForTimeout(5000);
  dllItechDcPowerWriteSerial("VOLT 10V");
  testWaitForTimeout(5000);
  dllItechDcPowerQuerySerial("MEAS:VOLT?",resultString,result);
  write("Measured voltage: %f",result);
  dllItechDcPowerQuerySerial("MEAS:CURR?",resultString,result);
  write("Measured current: %f",result);
  dllItechDcPowerWriteSerial("VOLT 800mV");
  testWaitForTimeout(5000);
  dllItechDcPowerWriteSerial("OUTP 0");
 }

⛏️ Built Using

After change to this project's root directory, run follow command to build this CAPL dll.

make

No test code has been added in this project.