Browse Source

fixups

git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@7608 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/zoom-1.0
jim 15 years ago
parent
commit
2c4b92985d
2 changed files with 11 additions and 2 deletions
  1. +5
    -1
      pc/calibrate.c
  2. +6
    -1
      pc/gpib.c

+ 5
- 1
pc/calibrate.c View File

@@ -89,12 +89,16 @@ void calibrate(int zoom, int gpib)

info("Initializing Keithley\n");
gpib_addr(gpib, 24);
keithley_init(gpib);
if (keithley_init(gpib) < 0) {
info("Not responding\n");
return;
}

info("Sweep\n");
for (i = -1.0; i <= 1.0; i += 0.01) {
keithley_current(gpib, i);
printf("requested %f, actual %f\n", i, keithley_read(gpib));
if (quit) break;
usleep(10000);
if (quit) break;
}


+ 6
- 1
pc/gpib.c View File

@@ -33,12 +33,17 @@ int gpib_addr(int fd, int addr)

int keithley_init(int fd)
{
float i;
gput(":syst:beep:stat 1");
gput(":sour:func:mode curr");
gput(":sour:del 0");
gput(":sour:curr 0");
gput(":sour:curr:range:auto on");
gput(":outp on");
drain(fd);
i = keithley_read(fd);
if (isnan(i))
return -1;
return 0;
}

@@ -56,7 +61,7 @@ float keithley_read(int fd)
float i, dummy;
gputv("read?", NAN);
gputv("++read", NAN);
if (fdgets(s, 128, fd, 1000) == NULL)
if (fdgets(s, 128, fd, 2000) == NULL)
return NAN;
if (sscanf(s, "%f,%f,", &dummy, &i) != 2)
return NAN;


Loading…
Cancel
Save