Hi,我是剛學用GPIB與visual C++控制 Keithley 2440的新手,
我用
Ke24xx_Read (smu, 1, &read, values); //'values' is declared as a Float
來讀取電壓,
此時在2440的螢幕可以讀取到正確的電壓,
可我卻無法將電壓值抓回來,
請問我是要抓read還是values呢?
麻煩各位高手幫忙.
謝謝!!
在 07-22-2010 08:56 PM
请看下这个链接,按照其说明
Ke24xx_Read(session, KI24XX_READ_RESISTANCE, numReadings, reading)
Trigger and get reading. Value returned in last parameter
Hi,你好:
謝謝你的回應,
我也有查過這個連結,
我主要有些地方不懂,
以下是我的程式
-----------------------------------------------------------------------------------------------------------------------------------
#include <stdlib.h
#include <stdio.h
#include <windows.h
#include <string.h
#include <visa.h
#include "hpe3631a.h"
#include "hp34401.h"
#include "Ke24xx.h"
void doDelay(ViSession,ViInt32);
ViStatus check(ViSession vi, ViString mesg, ViStatus errStatus);
int main ()
{
ViSession instrumentHandle1;
ViSession instrumentHandle2;
ViInt32 model;
ViBoolean result;
ViPReal64 voltage1;
ViReal64 result1;
ViReal64 result2;
ViReal64 result3;
ViInt32 numberOfReadings;
float values[100];
hpe3631a_init("GPIB0::8::INSTR", 0, 0, &instrumentHandle1);
Ke24xx_init("GPIB0::24::INSTR",&model, &instrumentHandle2);
Ke24xx_Configure_DC_IV (instrumentHandle2,0,10,-0.01,0,0);
hpe3631a_current(instrumentHandle1,2, 1);
hpe3631a_voltage(instrumentHandle1,2, 0);
hpe3631a_current(instrumentHandle1,1, 1);
hpe3631a_voltage(instrumentHandle1,1, 0);
hpe3631a_outputOn(instrumentHandle1,1);
hpe3631a_voltage(instrumentHandle1,1, 3.3);
hpe3631a_voltage(instrumentHandle2,2, 0);
hpe3631a_outputOn(instrumentHandle2,1);*/
for(int i=6;i<=6;i++)
{
hpe3631a_voltage(instrumentHandle1,2, i);
Sleep(1500);
hpe3631a_measureVoltage_Q(instrumentHandle1,2,&result1);
hpe3631a_measureCurrent_Q(instrumentHandle1,2,&result2);
result3=result2-0.0004;
Ke24xx_Read(instrumentHandle2,1,&numberOfReadings,values);
printf("voltage = %e\n", result1);
printf("current = %e\n", result3);
for(int j=1;j<=100;j++)
{
printf("values = %f\n", values[j]);
}
Sleep(1500);
}
Ke24xx_EnableSourceOutput(instrumentHandle2,0);
hpe3631a_outputOn(instrumentHandle1,0);
printf("Testing completed. Press any key\n");
getchar();
return VI_SUCCESS;
}
-----------------------------------------------------------------------------------------------------
主要是紅色字體那兩行搞不定.
執行Ke24xx_Read(instrumentHandle2,1,&numberOfReadings,values);
可在儀器的小螢幕看到正確的電壓值(4.3V左右),
但 printf("values = %f\n", values[j]);
在自己電腦螢幕上的值卻都很奇怪( -107374176.000000)
可以麻煩你幫忙告知Ke24xx_Read(instrumentHandle2,1,&numberOfReadings,values);
這一行到底要怎麼寫才能讀到正確的電壓值嗎?
謝謝!!
在 09-13-2010 01:46 AM
不好意思,回得晚了。
不知道您的问题后来解决没有?我觉得这个语句可能需要这么写,仅供参考。
Ke24xx_Read(instrumentHandle2,1,&numberOfReadings,values);
謝謝你的回覆喔,
我後來還是沒有解決,
就直接控制另一台multimeter去把值抓回來了,
我在用你建議的方法試看看.
謝謝!!