Keyboard Interrupt and NI-DAQ

Hi! I have this problem when using an AT-MIO-16E-10:
I made a program in Borland C++ 3.1 that does the following:
-reads in pretriggered mode from an A/D channel (with DAQ_Start);
-when the conversion is done a message is sent to my aplication (Config_DAQ_Event_Message);
- when the message is received by the callback function I do computations with the voltage that was acquired with the DAQ_Start in previous step and the result is sent to a D/A channel (I control a process, and the computations is a numeric PID algorithm).
- all this steps are executed for all datas that DAQ_Start sends to the buffer data. Pretriggered mode is enable and at the end of the main program I have an infinite loop that looks like this:
while(not ESC);
-so the A/D conversions,computations and the D/A conversions are done infinity until ESC is pressed.
The problem is that to notice my application when ESC is pressed I took the keyboard interrupt vector that treats the ESC message. Also in my program I have to change the reference of the process I control; the reference is change also by my keyboard interrupt procedure (if I press '1.0' the reference of the process is a voltage of 1.0V)
Now I get this error when executing the program:
-the A/D conversions are not done correctly (in tests I had values in my buffer even greater 4096, voltages greater then 10V, also a zero is inserted at the even adresses of the buffer - buffer[0], buffer[2], buffer[4]etc. are zero )
-if I don't install the interrupt in the main program and the code of the new keyboard interrupt (declared : void far interrupt my09(void); ) is still in the program (but never used,I don't take the vector interrupt) the result is the same as above.
-when I don't use the keyboard interrupt in my application I I don't put the code of the my keyboard interrupt procedure(the reference is equal with 1.0V in the main program, and I don't change it in any way) the program runs fine and no problem occurs.
Can you please tell what is the solution of this problem? Why can't I have the code of an interrupt procedure in my program?
All the functions that I use in my program are tested and correct implemented. In all other programs that I made, my keyboard interrupt procedure runs without errors and the results are correct. Also this application runs fine if a don't put the code of the keyboard interrupt procedure in it.

Hi again!
Actually I used the "while(1)" loop without using the keyboard interrupt in my application and it worked fine. What I'm confuse about is that even if I don't use the interrupt procedure in the main function and the code of the interrupt is still in my source code, but never used, just code that is never called, because I don't install it, the program gives me the same results as I've explained in the first post, with zeros inserted in the buffer, and voltages greater then 10V.
The timing is not the problem, I can say that for sure, because I've made a tricky one: I installed the keyboard interrupt in another program, that is a TSR. This TSR is activated by the keyboard and it sends all the data I need (in my case: the reference, the ESC fla
g and the CR flag, that memorize if these are pressed) to my NI-DAQ application (I've implemented some code of inter-process comunication). In this case the results are completely the expected one. And this is just because I don't have an interrupt procedure in the same program with NI-DAQ functions.
Neither the interrupt procedure is not the problem, because it's the same in the TSR, and it works fine.
Yet, another program I've done used the timer interrupt, and basically it does the same thing. At every two int 0x08 calls (a sample interval of 110ms) I do this (in the my0x08 procedure):
- AI_VRead...
- do the numeric PI algorithm to the data.
- AO_VWrite...
The result was still the same.
I'm using Borland C++ 3.1 for DOS. Now I'm asking if the problem is not from the compiler. Maybe the segment model I use (although I've tried all of them)or how the compiler is generating the code declared with the prototype:
void far interrupt my_0x09(void);

Similar Messages

Maybe you are looking for

  • With holding tax error FZ379-"Error in WHT certificate numbering"-Thailand

    Hi, We are receiving an error "FZ379 - Error in WHT certificate numbering" while posting an outgoing payment for a vendor in Thailnd. Here is the business process we follwed: 1. Posted Down payment request on vendor. 2. Paid down payment through F110

  • Would i notice a difference

    i know this probably sound like a stupid question but i am really a newbie to mac. Do you think i would notice a massive speed increase by upgrading from my 500mhz imac g3 summer 2001 to a powermac g4 1.42 DP. Also would leopard run well on the power

  • Open file without asking

    I've set pdf files to open with my default application (without asking). Nerveless, FF keeps asking whether to save or open the file. (The same happens with any file type, and also in safe mode and a new profile). Any idea? Thanks.

  • Certain Javascript Not Working in All Browsers

    Certain javascript elements on websites won't function at all, and it's not apparent why. For example, when I'm http://www.reddit.com/ and I try to upvote or downvote a submission, nothing will happen, and little text in the bottom left corner of my

  • In Design in Win 7

    I spent a day with the trial version of In Design in hopes of creating a decent eBook and thus far I'm finding it a none working peice of software in windows 7. It is not doing what it should do. Being connected to the cloud while using it has not pr