Delphi and National Instruments

I'm one of those people who insist on using National Instrument products even though they no longer officially support Delphi.  Seems like there is still enough support from the Delphi community to help keep me going.  I'm using their PCI-6229 board and also a PCI-6220 board.

*Min inDAQmxCreateAIThrmstrChanIex*
Last night I got through a tedious issue getting my program to make thermistor measurements.  I kept getting a "feature not supported" type error.  It turned out the problem was the value of Min I was specifying when setting up the thermistor channel.  I had been setting this to -80°C since that is what my thermistor could manage, but when I set this to 0°C my program finally started working.  The NI documentation didn't say anything about limits to this value.  Anyway, a little more trial and error and i
t looks like -32°C is the lowest temperature you can use here.

*Divide-by-Zero in DAQmxReadAnalogF64*
This error popped up as soon as I got past the above error, and it was a devil to track down.  It was intermittent and it displayed all of the characteristics of having overwritten memory, such as when you store more data in an array that it was dimensioned for.  And when it occurred the program would freeze up on the next niDAQmx function call.  This seemed to strengthen my hypothesis that some part of the driver was being corrupted.  I scoured my program for the possibilities that I had done this, but f
ound nothing.  It's a smallish test program.  More testing and I found that slight changes to other parts of the program caused the problem almost went away.  Another change, and it would happen all of the time.  Another change, intermittent again.  Again, these changes were being made in areas not related to this operation, which was convincing me even more that the driver was being corrupted by itself.  One thing I did notice when the program was more or less working was that it would occur reliably aft
er I did some voltage inputs (DAQmxCreateAIVoltageChan).  So I searched the NI forum (search = divide-by-zero DAQmxReadAnalogF64) and found two posts, one mine from last night mentioning my first encounter with this problem, and the other a few years old that held the clue to the solution. The solution?  Turn off the divide-by-zero error detection.  ???  Mask it???  Googling the code I found a post saying that  this is indeed the way to solve this problem and that is is used in Delphi apps that use QuickT
ime or COM.  Anyway, it all seems to be working now, except that I don't actually have my thermistor circuit hooked up yet so I haven't confirmed that I'm getting the correct temperature.

My final code:

function niExecuteAnalogIn(
        TaskInt:niTaskInt;
        var Values: array of double;
        var Count:LongInt):longint;
var CW: Word;
begin
  niResult:='DAQmxStartTask';
  Result:=DAQmxStartTask(TaskInt);      // Start the task
  if Result<>0 then Exit;

  niResult:='DAQmxReadAnalogF64';       // Execute the task

//  DAQmxReadAnalogF64(
//    taskHandle:Longint;
//    numSampsPerChan:Longint;
//    timeout:Double;
//    fillMode:DAQmxFillMode;
//    var readArray:Double;
//    arraySizeInSamps:Longint;
//    var sampsPerChanRead:Longint;
//    reserved:boolean):Longint; stdcall;

  CW := Get8087CW;
  try
    Set8087CW($133f);  // Disable FPU Exceptions
    Result:=DAQmxReadAnalogF64(
      TaskInt,                          // Task handle
      1,                                // Timeout in seconds
      1,                                // Samples per channel to read
      DAQmx_Val_GroupByScanNumber,      // Fill mode
      Values[0],                        // Value read
      Length(Values),                   // Array size in samples
      Count,                            // Number of samples actually read
      false);                           // Reserved
    if Result<>0 then Exit;
    Set8087CW(CW);    //restore
  except
  end;

  // Stop the task, normal way
  niResult:='DAQmxStopTask';
  Result := DAQmxStopTask(taskint);
end;

I hope this helps someone.
0
Mike
5/18/2009 10:32:27 PM
embarcadero.delphi.general 4258 articles. 0 followers. Follow

2 Replies
836 Views

Similar Articles

[PageSpeed] 31

You may want to structure the call like this...

  CW := Get8087CW;
  try
    Set8087CW($133f);  // Disable FPU Exceptions
    Result:=DAQmxReadAnalogF64(
      TaskInt,                          // Task handle
      1,                                // Timeout in seconds
      1,                                // Samples per channel to read
      DAQmx_Val_GroupByScanNumber,      // Fill mode
      Values[0],                        // Value read
      Length(Values),                   // Array size in samples
      Count,                            // Number of samples actually read
      false);                           // Reserved
    if Result<>0 then Exit;
  finally
    Set8087CW(CW);    //restore
  end;


- Brian
0
Brian
5/18/2009 11:04:07 PM
> {quote:title=Brian Cook wrote:}{quote}
> You may want to structure the call like this...
> 
>   CW := Get8087CW;
>   try
>     Set8087CW($133f);  // Disable FPU Exceptions
>     Result:=DAQmxReadAnalogF64(
>       TaskInt,                          // Task handle
>       1,                                // Timeout in seconds
>       1,                                // Samples per channel to read
>       DAQmx_Val_GroupByScanNumber,      // Fill mode
>       Values[0],                        // Value read
>       Length(Values),                   // Array size in samples
>       Count,                            // Number of samples actually read
>       false);                           // Reserved
>     if Result<>0 then Exit;
>   finally
>     Set8087CW(CW);    //restore
>   end;
> 
> 
> - Brian

Thanks for the suggestion.
0
Mike
5/21/2009 5:45:28 AM
Reply:

Similar Artilces:

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi for PHP or Delphi PRISM
Hi, I have the opportunity to develop a web-based library management system. Nothing fancy, just being able to do the usual CRUD stuff for books and provide a search facility. Borrowing is to be done via an email request to the library admin who then sends out the book(s). Since both Delphi for PHP and Delphi PRISM will enable me to develop the app, which one will allow me to deliver it in less time and also increase (even how small) my marketability as a web developer? Thanks. Phillip Flores Phillip Flores wrote: > Hi, > > I have the opportunity to develop a...

Delphi XE / Delphi 2010
Hello! I noticed that Embarcadero® Delphi® 2010 Version is not on the list of products on Embarcadero page. Or is it still possible to buy it? Will RAD Studio XE compile programs written in Delphi 2010 without problems.? Thanks. Am 13.09.2010 09:04, schrieb Petra Nemec: > Will RAD Studio XE compile programs written in Delphi 2010 without problems.? As always you will probably have to recreate the projects as the import is still a bit -- special. Christian Hello! Does anybody know if it is still possible to get a Delphi2010 trial version (if yes where)? ...

Delphi 5 to Delphi 6 and up
Dear List, Trying to add 7Zip compression support to my delphi application. I am using the ported 7Zip sdk (see their website, they have a link). I am stumped on how to rewrite a single function: function ReverseDecode(var Models: array of SmallInt; ....): ..... where the input is mostly a fixed size array of SmallInt. This code perfectly compiles and functions in Delphi 6 and up, but in Delphi 5 I get the error: There is no overloaded version of 'ReverseDecode' that can be called with these arguments And obviously, the input (fixed) isn't the same as the param de...

Delphi 7 to Delphi XE
Have been using Delphi 7 for many moons ( have got later versions but never upgraded to ) My first problem is: Component Palette. in XE it is a small toolbar docked in top right in Delphi 7 it gives a large view of all the components. I am struggling to be able to cope/access my components.in Delphi XE. Can I make the component pallette tool bar the same size as Delphi 7, or is there a fast way to view/choose all available components in XE, that I have not spotted yet? Kind Regards, Robert. Hi, What I know is that in Delphi 2010 and XE you can choose between t...

Delphi 4 to Delphi 2009
Hello, Thanks to all who answered my previous question. That was a great help. And atlast our client agreed to upgrade our delphi version from 4 to Delphi 2009. *Sigh*. But before that, I need to give the estimation and cost regarding the migration to delphi 2009. Can anyone tell me is there any tool to migrate from delphi 4 to delphi 2009 or just I need to compile our Delphi 4 application in Delphi 2009. I have read from the delphi 2009 feature matrix that Delphi 1 through Delphi 2007 import is possible in delphi 2009. But i am not that sure considering the size of our application. ...

Delphi 4 to Delphi 2007
Hello, I will have to port a D4 application (with source) to D2007. what kind of problem could I face ? I will have to go to customer site tommorow to analyse its source code to quote the work, what should I care of to hestimate the porting time ? Thanks John Terry wrote: > Hello, > I will have to port a D4 application (with source) to D2007. > what kind of problem could I face ? > I will have to go to customer site tommorow to analyse its source code > to quote the work, what should I care of to hestimate the porting time ? You can probably do it by just changi...

Delphi 5 to Delphi XE4
Thinking about making the conversion. Of course we have numerous components such as: TurboPower AsyncPro, TurboPower Orpheus ICS2 Synactis All-In-The-Box. You guys have any advice as to the effort and time it may possibly take. It is a large application, several hundred thousand lines. And that's what happens when using third party components, a lot of extra work. I have been burned a few times. I now minimize the use to a few well known suppliers, like TMS. I have "banned" a lot of other components. Regards, Ole > > Thinking about making the conver...

Delphi and virus, or virus and Delphi.
Hi all. There is some discussion about a 'new' virus, that targets Delphi (and developers). The article is in danish: <http://www.version2.dk/artikel/11833-delphi-udviklere-jages-af-ny-type-malware> but refers to this article: <http://news.cnet.com/8301-27080_3-10312628-245.html> From the Danish article POV, it seems like Delphi itself is vunerable, which is not true. As far as i can see, is the attack vector, injection of (source) code in the 'Sysconst' unit. What's going on? -- Best regards Stig Johansen Perhaps checking other thre...

delphi.general
Sorry if this is "out of topic"! but since some days ago I can't read the group *embarcadero.public.delphi.language.delphi.general* Does anybody know if there's something wrong with it? Or maybe is my reader? (Thunderbird) I get this messagge when I try to read the latest messages: Error! newsgroup server responded:no such article found Perhaps the article has expired <692702@forums.embarcadero.com> (33145) Click here to remove all expired articles sergio wrote: > Sorry if this is "out of topic"! but since some days ago I can'...

Delphi 7 to Delphi XE2
Hi, Still using that old workhorse, Delphi7, but am going to the conference in London hosted by Embarcadero on Delphi XE2. Although I would like to "move with the times" and am keen to get the UNICODE and 64-bit support offered by the latest IDEs, I confess to being more than a little scared about all the UNICODE/String/AnsiString and 32/64 bit issues I'm probably going to fall over. Anyone recently upgraded from Delphi7 to one of the latest Delphi IDEs? Thanks, Alain On 03/02/2012 08:55, Alain Dekker wrote: > Still using that old workhorse, Delphi7, but...

from delphi 6 to delphi 2010
Hi. It is possible, with component RX, dxforumlibrary, InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. Thank by comments. excequiel arostica wrote: >Hi. > It is possible, with component RX, dxforumlibrary, >InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. > >Thank by comments. Rx is dead and sources are taken over by jcl/jvcl. I dont know about the rest of the components and i have no experiences with bde over the last 9 years. excequiel arostica wrote: > Hi. > It is possible, with component RX, dxforumlibrary,...

Delphi 5 To Delphi 2009
I upgraded to Delphi 2009 from D5. The install says I can install Delphi and/or C++. Delphi installed OK but I see nothing of C++. What am I missing or does my upgrade not include C++? Thanks It depends on what you bought. If you bought Delphi 2009 only, that's what you get. If you bought Delphi 2009 and C++ Builder 2009 you get both. My guess is you got Delphi 2009 only. The simplest way to verify is look your invoice - it should say I would think. You could also go to members.embarcadero.com, login, then click on my registered products. There will be a textual description of...

Web resources about - Delphi and National Instruments - embarcadero.delphi.general

Experimental musical instrument - Wikipedia, the free encyclopedia
... modifications, such as cracked drum cymbals or metal objects inserted between piano strings in a prepared piano . Some experimental instruments ...

Blunt Instrument: Malcolm Turnbull's ideas idea not a moment too soon
Malcolm Turnbull had an idea once. Along with some other guys, he helped turn it into a company called Ozemail and trousered a shedload of the ...


- One-man band brings homemade instruments, humor to Volcanic Theatre Pub
The Magic Pipe set the mood Monday night at Volcanic Theater Pub before That 1 Guy even played a note. The 7-foot tall, homemade collection of ...

Adele proves 'Hello' is still great with kid instruments and a toy flip phone on Jimmy Fallon
Adele joined Jimmy Fallon and the Roots to perform "Hello" on classroom instruments during Tuesday night's "Tonight Show." The performance wouldn't ...

Seiko Instruments (SII) Releases New Automotive LDO Regulator Capable of 50V Input Voltage and 200mA ...
Seiko Instruments Inc. (SII) announced the release of the S-19200 Series automotive LDO regulator with high input voltage of 50V, adopting a ...

Adele takes on "Hello" with classroom instruments
The British singer sounded flawless during her visit to "The Tonight Show Starring Jimmy Fallon" on Tuesday

Ocean Winds Play Music on Seashore Instrument
The Sea Organ uses the Adriatic Sea to play a beautiful symphony of sound.

Open Post: Hosted By Adele Doing The Classroom Instrument Version Of “Hello”
Open Post is going up sooner than usual today, because I know that many of you are leaving your job early to spend hours preparing for Skanksgiving... ...

Native Instruments uses 3D Touch for better mobile beat making
Native Instruments is a huge player in the music production and DJ world. Its Traktor DJ software and (myriad) hardware controllers are a favorite ...

Resources last updated: 12/12/2015 10:29:42 AM