August 08, 2006
On Tue, 8 Aug 2006 03:52:14 +0200, Emp wrote:

> Thx!
> Now if only I would understand why there are  lines like these in the
> original header file:
> 
> //*** Values for DAQmx_Read_WaitMode ***
> //*** Value set WaitMode ***
> #define DAQmx_Val_WaitForInterrupt 12523 // Wait For Interrupt
> #define DAQmx_Val_Poll 12524 // Poll
> #define DAQmx_Val_Yield 12525 // Yield
> #define DAQmx_Val_Sleep 12547 // Sleep
> //*** Values for DAQmx_Write_WaitMode ***
> //*** Value set WaitMode2 ***
> #define DAQmx_Val_Poll 12524 // Poll
> #define DAQmx_Val_Yield 12525 // Yield
> #define DAQmx_Val_Sleep 12547 // Sleep
> 
> See the double defining. Any idea of why is this done?

Poor quality control.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
8/08/2006 11:55:18 AM
August 08, 2006
> Poor quality control.
:D

HtoD commented all the error handling code out, so your nice code doesn't
work :(
(main.d(46): undefined identifier DAQmxFailed)
Why did htod do this?

//from header file
/******************************************************************************
 *** NI-DAQmx Error Codes
*****************************************************
 ******************************************************************************///C     #define DAQmxSuccess                                  (0)//C     #define DAQmxFailed(error)                            ((error)<0)// Error and Warning Codes//C     #define DAQmxErrorCOCannotKeepUpInHWTimedSinglePoint(-209805)//C     #define DAQmxErrorWaitForNextSampClkDetected3OrMoreSampClks(-209803)

August 08, 2006
let me retype that:

 //from header file
/**********************************
*** NI-DAQmx Error Codes
 *********************************************************/
//C     #define DAQmxSuccess                                  (0)
//C     #define DAQmxFailed(error)                           ((error)<0)
// Error and Warning Codes
//C     #define DAQmxErrorCOCannotKeepUpInHWTimedSinglePoint
(-209805)
//C     #define DAQmxErrorWaitForNextSampClkDetected3OrMoreSampClks
(-209803)


August 08, 2006
I changed it to:

const DAQmxSuccess=0;

bool DAQmxFailed(int error){
 if (error<0) return true;
 return false;
}

And changed your code with:
throw new StringException()

So now I get this error:
C:\Program Files\...\NIDAQmx.lib
 Error 43: Not a Valid Library File
:D
I'm beginning to get this feeling that maybe everything was for nothing :(


> let me retype that:
>
> //from header file
> /**********************************
> *** NI-DAQmx Error Codes
> *********************************************************/
> //C     #define DAQmxSuccess                                  (0)
> //C     #define DAQmxFailed(error)                           ((error)<0)
> // Error and Warning Codes
> //C     #define DAQmxErrorCOCannotKeepUpInHWTimedSinglePoint (-209805)
> //C     #define DAQmxErrorWaitForNextSampClkDetected3OrMoreSampClks
> (-209803)
>
>



August 08, 2006
NEmp wrote:
> I changed it to:
> 
> const DAQmxSuccess=0;
> 
> bool DAQmxFailed(int error){
>  if (error<0) return true;
>  return false;
> }
> 
> And changed your code with:
> throw new StringException()
> 
> So now I get this error:
> C:\Program Files\...\NIDAQmx.lib
>  Error 43: Not a Valid Library File
> :D
> I'm beginning to get this feeling that maybe everything was for nothing :(

Not at all. I've been using NI-DAQmx with D for months. I can confirm that it works perfectly after translation. I'd post you my translation, except that would probably violate NI's copyright restrictions.

You need to run the 'coffimplib' program (download from Digital Mars) on NIDAQmx.lib, to turn it from a Microsoft-format import lib into Digital Mars/Watcom/etc format.

BTW, the reason all those #defines are duplicated is that they really should have been enums.

Good to see another NI user.
August 08, 2006
Oh Yeah! my first readout from my virtual card :D.
Thx, everybody.

> Not at all. I've been using NI-DAQmx with D for months. I can confirm that it works perfectly after translation. I'd post you my translation, except that would probably violate NI's copyright restrictions.

Could you maybe tell me how you handled the error handling code which htod commented out?

> You need to run the 'coffimplib' program (download from Digital Mars) on NIDAQmx.lib, to turn it from a Microsoft-format import lib into Digital Mars/Watcom/etc format.
>
> BTW, the reason all those #defines are duplicated is that they really should have been enums.

You mean that the original (labview) headers were enums?

>
> Good to see another NI user.

(I will be using the physical card for the readout of a purkinje eye tracker, pretty nifty stuff :)


August 10, 2006
Emp wrote:
> Oh Yeah! my first readout from my virtual card :D.
> Thx, everybody.
> 
>> Not at all. I've been using NI-DAQmx with D for months. I can confirm that it works perfectly after translation. I'd post you my translation, except that would probably violate NI's copyright restrictions.
> 
> Could you maybe tell me how you handled the error handling code which htod commented out?

I did my translation before htod existed.
It's pretty simple stuff though...

bool DAQmxFailed(int error) { return error<0; }

and all the errors should be constants.

const DAQmxSuccess = 0;
const DAQmxErrorCOCannotKeepUpInHWTimedSinglePoint = -209805;

.. repeat 2000 times or so. <g>


> 
>> You need to run the 'coffimplib' program (download from Digital Mars) on NIDAQmx.lib, to turn it from a Microsoft-format import lib into Digital Mars/Watcom/etc format.
>>
>> BTW, the reason all those #defines are duplicated is that they really should have been enums.
> 
> You mean that the original (labview) headers were enums?

No, but they should have been. The original headers seem to be written in very ancient C (about 1982 era :-) ).

> 
>> Good to see another NI user.
> 
> (I will be using the physical card for the readout of a purkinje eye tracker, pretty nifty stuff :) 

Cool! I think D is fantastic for this stuff.
1 2
Next ›   Last »