The manual has most of the info I'd need. You'll need the SDK and in particular the file PicoHRDL.dll. In the manual, to read analog channels, check out section 188.8.131.52, single reading, blocking. You can see it requires only three steps, two of which only need to be done once at startup, open and setMains, and my guess is that setMains isn't even required, but probably a good idea.
To get access to the needed functions, use the extern() function in DAQFactory. For example:
extern("c:\daqfactory\picohrdl.dll", "short HRDLOpenUnit()", "HRDLOpenUnit", "stdcall")
extern("c:\daqfactory\picohrdl.dll", "short HRDLSetMains(short, short)", "HRDLSetMains", "stdcall")
extern("c:\daqfactory\picohrdl.dll", "short HRDLGetSingleValue(short, short, short, short, short, short, long)", "HRDLGetSingleValue", "stdcall")
That will load those three functions. Notice how I used short and long for the short * and long * of the function prototype (5.4.5 in their manual). Then, probably right after the extern() lines, you'd do:
global hrdlHandle = HRDLOpenUnit()
if (hrdlHandle <= 0)
system.messageBox("unable to open")
That will open the unit and set the noise rejection. Now you can read values. For example, if you had a Test channel with Timing = 0 called "Pico1", and you wanted to read analog 1 (it appears they number from 1??) off the pico unit with range +/- 625mV, with a 100ms conversion time, single ended, once a second you'd do something like:
private overflow = 0
private datain = 0
status = HRDLGetSingleValue(hrdlHandle, 1, 2, 1, 1, @overflow, @datain)
if (status == 1)
datain.time = systime()
? "HRDLGetSingleValue failed"
That's about it for the basics. You can take advantage of the other functions too. It appears that their driver does not use callbacks, so its likely you could actually stream these units through extern(), though that's a little more advanced. Two things:
1) I did this code off the cuff and do not have a unit to test on, so you might have to do some debugging of my code. Please post working code when you get it so others can see.
2) you probably should replace those constants in the HRDLGetValues with variables to make it more readable. You can try using the include() function to actually bring in the constants from their header file even, but I didn't download the SDK so didn't have access to the header.
3) start simple and just see if you can get the open function to load and work. You can just type the extern() command in the command/alert window, then try calling the function. Note that repetitive calling of open might use up internal resources in their DLL. They have a close function as well you may need to call. Its not clear if quiting DAQFactory will clean up those resources or not. You'll be able to tell its not working when you do open() and it fails when it was just working a minute ago.