From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6008-DAQ every few milliseconds an "interrupt"

Hello,

 

well I hope you can help me with a little problem I have. I need to interrupt my program all few milliseconds to read in one analogue input and three digital inputs. Well this isn't a real interrupt indeed ... Much more a programcode that should be called every few milliseconds, if there is no other programcode called.

 

For example:

 

DAQmxCreateTask("DirectionVoltage",&taslHandle);
DAQmxCreateAIVoltageChan(taskHandle,....);
 

DAQmxErrChk (DAQmxCreateTask("InductiveSensor",&InductiveSensor));

DAQmxErrChk (DAQmxCreateDIChan(InductiveSensor,"Dev2/port0/line0","",DAQmx_Val_ChanPerLine));

 

These are my two inputs. Then there runs my DLL, where the user can change analogue outputs etc. pp. But about every 10 milliseconds there should be a short interrupt, where the actual state of my inputs should be written to shadow variables, who can be read out by the user of the DLL.

 

Short program explanation:

 

Initialization();

readin();                     //this should do the interrupt

ChangeDirection(left); //user changes the direction of the engine - this should be finished first and not being interrupted by the "readin()"-routine!

readin();

readin();

readin();

CheckState();             //now the user wants to check the shadow variables

readin();

readin();

....

 

Maybe there's any programcode for ANSI C I didn't see in the help-file?

 

Sincerely

Andreas

0 Kudos
Message 1 of 2
(2,456 Views)

Hi,

 

what you describe sounds like a state machine to me. Have you already checked how you can program one in CVI ? There is an example there : https://decibel.ni.com/content/docs/DOC-22549 .

 

'Hope it helps !

Aurelie

0 Kudos
Message 2 of 2
(2,402 Views)