PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
PROCEDURE TMainForm.SystemTimerTimer(Sender: TObject);
var
temp_buffer : real;
times_buffer : longint;
buffer_length : LONGINT;
overflow : smallint;
samplechannel: smallint;
ok : smallint;
tpower : word;
MytimeNow : real;
errorcode :Smallint;
begin
if (tc08_handle > 0) then
begin
if (not in_timer) then
begin
in_timer := true;
with insertTestdata DO
BEGIN
/////Call to get temp
ok:=usb_tc08_get_temp (tc08_handle,temp_buffer,times_buffer,500,overflow,1,0,0);
if ok<0 then
BEGIN
errorCode:=usb_tc08_get_last_error(tc08_handle);
showmessage ('Error '+inttostr (errorcode));
END;
if (ok>0) then
begin
If NOT (isnan(temp_buffer)) THEN
BEGIN
Lab_probe.value:=temp_buffer;
parambyname('Probe_temp').Value:=temp_buffer;
temptimeseries.addXY(now,temp_buffer);
END
Code: Select all
long usb_tc08_get_temp
(
short handle,
float * temp_buffer,
long * times_ms_buffer,
long buffer_length,
short * overflow,
short channel,
short units,
short fill_missing
)
Code: Select all
float temp_buffer[buffer_length];
long times_ms_buffer[buffer_length];
short overflow;
ok = usb_tc08_get_temp(tc08_handle, temp_buffer, times_ms_buffer, buffer_length, &overflow, channel, USBTC08_UNITS_CENTIGRADE, fill_missing);
Code: Select all
PROCEDURE TMainForm.SystemTimerTimer(Sender: TObject);
var
temp_buffer : array[0..9] of single;
times_buffer : array[0..9] of Longint;
buffer_length : LONGINT;
overflow : smallint;
samplechannel: smallint;
ok : smallint;
tpower : word;
MytimeNow : real;
errorcode :Smallint;
begin
if (tc08_handle > 0) then
begin
if (not in_timer) then
begin
with insertTestdata DO
BEGIN
ok:=usb_tc08_get_temp (tc08_handle,temp_buffer,times_buffer,9,overflow,0,0,0);
if ok<0 then
BEGIN
errorCode:=usb_tc08_get_last_error(tc08_handle);
showmessage ('Error '+inttostr (errorcode));
END;
if (ok>0) then
begin
If NOT (isnan(temp_buffer[0])) THEN
Code: Select all
[code]function usb_tc08_get_temp(
handle : smallint;
var temp_buffer : array of single;
var times_ms_buffer : array of longint;
buffer_length : longint;
var overflow : smallint;
channel : smallint;
units : smallint;
fill_missing : smallint)
: smallint;
{$IFDEF WIN32} stdcall; external 'usbtc08.dll'{$ENDIF}
Code: Select all
temp_buffer : array[0..9] of real;
Code: Select all
var temp_buffer : array of real;
Code: Select all
int main(void)
{
short hTemp;
int i;
float temp_buffer[100];
long times_ms_buffer[100];
short buffer_length = 100;
short overflow;
hTemp = usb_tc08_open_unit();
usb_tc08_set_channel (hTemp, 1, 'K');
usb_tc08_run(hTemp, 100);
Sleep(1000);
usb_tc08_get_temp(hTemp, temp_buffer, times_ms_buffer, buffer_length, &overflow, 1,0,0);
for ( i= 0; i<100; ++i)
printf("Temp %2f\n",temp_buffer[i]);
usb_tc08_close_unit(hTemp);
}
Thanks for that.Martyn wrote:Code: Select all
int main(void) { short hTemp; int i; float temp_buffer[100]; long times_ms_buffer[100]; short buffer_length = 100; short overflow; hTemp = usb_tc08_open_unit(); usb_tc08_set_channel (hTemp, 1, 'K'); usb_tc08_run(hTemp, 100); Sleep(1000); usb_tc08_get_temp(hTemp, temp_buffer, times_ms_buffer, buffer_length, &overflow, 1,0,0); for ( i= 0; i<100; ++i) printf("Temp %2f\n",temp_buffer[i]); usb_tc08_close_unit(hTemp); }