03-12-2013 02:43 AM
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:
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
03-22-2013 07:41 AM
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