The CTRL class
The "kitchen" of the program
In this class the program prototypes/modules are defined. The CTRL class owns
objects of the classes DAQ, FIO and LED and accesses their public functions. Also note that the
multithreading part is done here.
The aim of this class is to provide a better structure in main.cpp which thus
becomes basically a list of program prototypes/modules.
This class is rather simple - the actual functions are mostly only lists of calls of functions
from the DAQ, FIO and LED class. The only part that is not too easy is teh multithreading. But you don't
need to understand the parameters. It all the same again and again. You will be able to modify these parts
even without having a clue about the actual structure of the parameters...
The header file ctrl.h
The header file with all function declarations. Most functions are public, since the main aim of this class
is to provide a convenient way to use program modules in the main program. For reasons of convenience all public
functions are of the type void().
/*******************************************************************/
/* C R T L *** C R T L *** C R T L ***/
/* C R T L *** C R T L *** C R T L ***/
/* C R T L *** C R T L *** C R T L ***/
/* Class declaration of CTRL, CTRL functions are used in main() ***/
/*******************************************************************/
#ifndef __myCTRL__
#define __myCTRL__
class CTRL
{
public:
some bureaucracy functions first:
CTRL();
void startup();
void namefalse();
void quit();
now some visual stimulus functions:
void stripeX(); // vert stripes
void stripesH(); // horiz stripes
void down();
void up();
void VStest(); // modification pattern
void flash();
functions for preferences and about:
void prefs();
void tellprefs();
void about();
read analog in, or give analog out. The parameter bool para determines whether
a set of sinosoidal signals or pulses gets applied.
For the input function here only the first parameter is interesting: true sets the amplifier to bridged mode,
false to voltage clamp mode. The other two parameters are useless in a non-multithreading context and should
be set to NULL.
void AOut(bool para);
void AIN(bool mode, int modeswdel1, int modeswdel2);
The following functions starting with MT_* are multithreaded functions, the names should
indicate more or less what they do...
the parameters used here:
bool mode - starting mode of the amplifier, true= bridged, false= voltage clamp
int modeswdel1 - modeswitch of amplifier operation atfer n miliseconds,
NULL leads to no mode switch
int modeswdel2 - 2nd modeswitch (i.e back to starting mode) of amplifier operation
atfer n miliseconds, NULL leads to no 2nd mode switch
bool direction when a visual stimulus is applied this parameter selects vertical
or horizontal stimuli. true leads to vertical stripes, false to horizontal ones
bool pd selection of preferred direction of the visual stimulus. true leads to
downward or right to left stripes, false to upward or left to right stripes.
void MT_AInStripes(bool mode, int modeswdel1, int modeswdel2);
void MT_AInRandomStripes(bool mode, int modeswdel1, int modeswdel2);
void MT_AInVStest(bool mode, int modeswdel1, int modeswdel2);
void MT_AInLStripes(bool mode, int modeswdel1, int modeswdel2, bool direction, bool pd);
void MT_AInAOutStri(bool mode, int modeswdel1, int modeswdel2, bool para);
void MT_AInAOut(bool mode, int modeswdel1, int modeswdel2, bool para);
void MT_AInAOutSetS(bool mode, int modeswdel1, int modeswdel2);
void MT_VC_loStr(bool mode, int modeswdel1, int modeswdel2);
void MT_VC_loNoS(bool mode, int modeswdel1, int modeswdel2);
void MT_VC_hiStr(bool mode, int modeswdel1, int modeswdel2);
void MT_VC_hiNoS(bool mode, int modeswdel1, int modeswdel2);
void MT_VC_rampStr(bool mode, int modeswdel1, int modeswdel2);
void MT_VC_rampNoS(bool mode, int modeswdel1, int modeswdel2);
void MT_P_rec(bool mode, int modeswdel1, int modeswdel2);
void MT_CStep_flash(bool mode, int modeswdel1, int modeswdel2);
void MT_CStep(bool mode, int modeswdel1, int modeswdel2);
functions for applying and adjusting pulses
void P_adjust();
void P_apply();
functions for applying and adjusting three current steps
void CStep();
void CS_adjust();
a rather useless function and a re-init the DAQ board function
void oops();
void openclose();
the private functions are probably not of much interest for most users. There is some stuff for the
multithreading and some other things.
private:
DAQ myDAQ;
LED myLED;
bool nameincrement;
bool toggle;
bool para;
void init();
void close();
const MAX_THREADS;
HANDLE hThreads [3]; // Array size = MAX_THREADS
DWORD id [3]; // Array size = MAX_THREADS
DWORD waiter;
// DWORD WINAPI dummythread(LPVOID);
char version [35];
};
#endif
The ctrl.cpp file
Here's the implementation of the functions provided by the CTRL class. Most stuff is stright forward
and the caled DAQ.* and LED.* should make pretty clear whats happening.
#ifndef _nada_
#define _nada_
#include "myIncludes.h"
CTRL::CTRL() : nameincrement (false), toggle (false), MAX_THREADS(3), waiter (NULL)
{}
void CTRL::startup()
{
char version[35] = "1.7.1 *** Date: 12-08-2009"; ///// *NUR* hier Versionsnummer & Datum eintragen
NOTE: It is *very* important to change this string whenever changes to the program are made. The log file
written by the program adds the date and version number from *this* string. If you forget to modify this string
it will not be possible to say from which program version a recoded data set actually stems. And that can lead
to some serious trouble...
strcpy (myDAQ.version ,version);
myDAQ.initGeneral();
myDAQ.initPrefs();
myDAQ.gimmePrefs();
myDAQ.zufall();
init();
myLED.SECpara(true, NULL, NULL); // SEC to bridged mode
myDAQ.SECpara(true, NULL, NULL);
myLED.SECctrl();
cout<<"Startup successfull - have a nice day!"<
close();
}
void CTRL::namefalse()
{
myDAQ.tellPrefs(nameincrement);
nameincrement = false;
}
void CTRL::quit()
{
if (toggle)
{
myDAQ.initDO();
myLED.SetHandle(myDAQ.hAdapter);
myLED.LEDreset(); //LEDreset and close subsystems
myDAQ.schliessenDO();
}
myDAQ.schliessen();
cout <
}
void CTRL::init()
{
myDAQ.initAI();
myDAQ.initAO();
myDAQ.initDO();
myLED.SetHandle(myDAQ.hAdapter);
myDAQ.zufall();
myLED.LEDreset();
}
void CTRL::close()
{
myLED.LEDreset();
myDAQ.schliessenAI();
myDAQ.schliessenAO();
myDAQ.schliessenDO();
myLED.SetHandle(myDAQ.hAdapter);
}
void CTRL::stripeX() // vert alternating Stripes
{
myDAQ.initDO();
myLED.SetHandle(myDAQ.hAdapter);
myLED.stripev();
myLED.LEDreset(); //LEDreset und Subsys schließen
myDAQ.schliessenDO();
}
void CTRL::stripesH() // horiz Stripes
{
myDAQ.initDO();
myLED.SetHandle(myDAQ.hAdapter);
myLED.stripe();
myLED.LEDreset(); //LEDreset und Subsys schließen
myDAQ.schliessenDO();
}
void CTRL::down()
{
myDAQ.initDO();
myLED.SetHandle(myDAQ.hAdapter);
myLED.endless(false);
myLED.stripeDown();
myLED.LEDreset(); //LEDreset und Subsys schließen
myDAQ.schliessenDO();
}
void CTRL::up()
{
myDAQ.initDO();
myLED.SetHandle(myDAQ.hAdapter);
myLED.endless(true);
myLED.stripeUP();
myLED.LEDreset(); //LEDreset und Subsys schließen
myDAQ.schliessenDO();
}
void CTRL::VStest()
{
myDAQ.initDO();
myLED.SetHandle(myDAQ.hAdapter);
myLED.VStest();
myLED.LEDreset(); //LEDreset und Subsys schließen
myDAQ.schliessenDO();
}
void CTRL::flash()
{
if (toggle == false)
{
cout<<"I'll give you the blues..."<
myDAQ.initDO();
myLED.SetHandle(myDAQ.hAdapter);
myLED.testbild(); //Testbild an
myDAQ.schliessenDO(); // Subsys schließen
toggle= true;
}
else
{
cout<<"Go away and leave me in darkness.."<
myDAQ.initDO();
myLED.SetHandle(myDAQ.hAdapter);
myLED.LEDreset(); //LEDreset und Subsys schließen
myDAQ.schliessenDO();
toggle=false;
}
}
void CTRL::AOut(bool para)
{
init();
myDAQ.sinostep(para);
myDAQ.AOtest();
myDAQ.writeLog(5);
close();
}
void CTRL::AIN(bool mode, int modeswdel1, int modeswdel2) // rm #1 AIN
{ // automatic SEC ctrl
init();
myDAQ.setrecduration(8);
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC to bridged mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
myLED.SECctrl(); // Diese Funktion wird hier *nicht* im Multithreading gestartet
// d.h. modeswdel1&2 führen nur zu einer verzögerung der Aufnahme
// aber zu keinem Moduswechsel während der Aufnahme
// Wenn das gewünscht ist sollte myLED.SEcctrl im Multithreading genutzt werden
myDAQ.readIn();
myDAQ.writeLog(1);
close();
nameincrement=true;
}
// FUNCTIONS using MULTITHREADING
void CTRL::MT_AInStripes(bool mode, int modeswdel1, int modeswdel2) // rm #10 stripes & AIN
{ // Manual SEC ctrl
init();
myDAQ.setrecduration(8); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC to bridged mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
hThreads[0] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(led_stripev), &myLED, NULL, &id[1]);
waiter = WaitForMultipleObjects(MAX_THREADS -1 ,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS -1; k++) //Max_threads hier = 2
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(10);
nameincrement=true;
close();
}
void CTRL::MT_AInRandomStripes(bool mode, int modeswdel1, int modeswdel2) // rm#11 vertical stripes in zuf. Reihenfolge & AIN
{ // Manual SEC ctrl
init();
myDAQ.setrecduration(9); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC to bridged mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
hThreads[0] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(led_randomStripe), &myLED, NULL, &id[1]);
waiter = WaitForMultipleObjects(MAX_THREADS -1 ,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS -1; k++) //Max_threads hier = 2
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(11);
nameincrement=true;
close();
}
void CTRL::MT_AInVStest(bool mode, int modeswdel1, int modeswdel2) // rm#12 VS classification patterns
{ // automated SEC ctrl (in dedicated thread!!)
init();
myDAQ.setrecduration(25); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC to bridged mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
hThreads[0] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[1]);
hThreads[2] = CreateThread(NULL,0,&(led_VStest), &myLED, NULL, &id[2]);
waiter = WaitForMultipleObjects(MAX_THREADS ,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS ; k++) //Max_threads hier = 3
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(12);
nameincrement=true;
close();
}
void CTRL::MT_CStep_flash(bool mode, int modeswdel1, int modeswdel2) // rm 13
{ //manual SEC ctrl
init();
myDAQ.setrecduration(15);
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC to bridged mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
hThreads[0] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(led_stripeDown), &myLED, NULL, &id[1]);
waiter = WaitForMultipleObjects(MAX_THREADS-1,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS-1; k++) //Max_threads hier = 2
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(13);
nameincrement=true;
close();
}
void CTRL::MT_AInLStripes(bool mode, int modeswdel1, int modeswdel2, bool direction, bool pd) // rm # 14, 15, 16 & 17 AIN + 1 s stationary stripe pattern + prolonged stripes (4s) in pd + 4s stationary pattern
{ // DON'T USE A DEDICATED THREAD HERE TO CONTROL THE SEC TO AVOID TIMING ISSUES // SEC ctrl integrated into lstripe()
init(); // If a dedicated thread is used it will control the SEC, the integrated control of lstripe() gets overridden
myDAQ.setrecduration(11); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC operation mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
myLED.lstripepara(direction, pd);
hThreads[0] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(led_lstripe), &myLED, NULL, &id[1]);
waiter = WaitForMultipleObjects(MAX_THREADS -1 ,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS -1; k++) //Max_threads hier = 2
{
CloseHandle(hThreads[k]);
}
if (direction)
{
if(pd)
myDAQ.writeLog(14);
else
myDAQ.writeLog(15);
}
else
{
if (pd)
myDAQ.writeLog(16);
else
myDAQ.writeLog(17);
}
nameincrement=true;
close();
}
void CTRL::MT_AInAOutStri(bool mode, int modeswdel1, int modeswdel2, bool para) // rm#20 & 30 stripes & AIn & Sine out (20) pulses (30)
{ // rm #20 automatic SEC ctrl
init(); // rm #30 manual SEC ctrl
myDAQ.setrecduration(11); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC operation mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
myDAQ.sinostep(para); // Sinus (para=true) or pulses (para=false)
myLED.endless(true); // Endlosstreifen?
if (para)
{
hThreads[0] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
}
else
{
hThreads[0] =CreateThread(NULL,0,&(daq_dummythread), &myDAQ, NULL, &id[0]);
}//
hThreads[1] = CreateThread(NULL,0,&(led_stripeDown), &myLED, NULL, &id[1]);
Sleep(100); // Muster bevor Daten aufgezeichent werden, um Onseteffekte zu vermeiden, Kann beliebig veraendert werden
hThreads[2] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[2]);
hThreads[3] = CreateThread(NULL,0,&(daq_AOtest), &myDAQ, NULL, &id[3]);
waiter = WaitForMultipleObjects(MAX_THREADS,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS+1; k++) //Max_threads hier = 3
{
CloseHandle(hThreads[k]);
}
if (para) {myDAQ.writeLog(20);} // Sinus
else {myDAQ.writeLog(30);} // Pulse
nameincrement=true;
close();
}
void CTRL::MT_AInAOut(bool mode, int modeswdel1, int modeswdel2, bool para) // rm #21 & 31 AIn & Sine out (21) pulses (31)
{ // rm #21 automatic SEC ctrl
init(); // rm #31 manual SEC ctrl
myDAQ.setrecduration(11); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC operation mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
myDAQ.sinostep(para); // Sinus (para=true) or pulses (para=false)
if (para)
{
hThreads[0] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
}
else
{
hThreads[0] =CreateThread(NULL,0,&(daq_dummythread), &myDAQ, NULL, &id[0]);
}
hThreads[1] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[1]);
hThreads[2] = CreateThread(NULL,0,&(daq_AOtest), &myDAQ, NULL, &id[2]);
waiter = WaitForMultipleObjects(MAX_THREADS-1,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS; k++) //Max_threads hier = 2
{
CloseHandle(hThreads[k]);
}
if (para) {myDAQ.writeLog(21);} // Sinus = true
else {myDAQ.writeLog(31);} // Pulse = false
nameincrement=true;
close();
}
void CTRL::MT_AInAOutSetS(bool mode, int modeswdel1, int modeswdel2) // rm 21 ruft MT_AInAOut(mode, modeswdel1, modeswdel2, true) auf
{
myDAQ.sinostep(true);
myDAQ.setSineAmp();
MT_AInAOut(mode, modeswdel1, modeswdel2, true);
}
void CTRL::MT_VC_loStr(bool mode, int modeswdel1, int modeswdel2) // rm #40stripes & AIn & low steps
{ // automatic SEC ctrl (VC)
init();
myDAQ.setrecduration(9); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC operation mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
myLED.endless(false);
hThreads[1] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
hThreads[2] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[1]);
hThreads[3] = CreateThread(NULL,0,&(led_stripeDown), &myLED, NULL, &id[2]);
hThreads[4] = CreateThread(NULL,0,&(daq_VCtest12), &myDAQ, NULL, &id[3]);
waiter = WaitForMultipleObjects(MAX_THREADS,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS+1; k++) //Max_threads hier = 4
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(40);
nameincrement=true;
close();
}
void CTRL::MT_VC_loNoS(bool mode, int modeswdel1, int modeswdel2) // rm #41 Ain & low steps
{ // automatic SEC ctrl (VC)
init();
myDAQ.lang();
myDAQ.setrecduration(9); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC operation mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
hThreads[0] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[1]);
hThreads[2] = CreateThread(NULL,0,&(daq_VCtest12), &myDAQ, NULL, &id[2]);
waiter = WaitForMultipleObjects(MAX_THREADS-1,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS; k++) //Max_threads hier = 3
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(41);
nameincrement=true;
myDAQ.langoff();
close();
}
void CTRL::MT_VC_hiStr(bool mode, int modeswdel1, int modeswdel2) // rm #42 f & AIn & high steps
{ // automatic SEC ctrl (VC)
init();
myDAQ.setrecduration(9); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC operation mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
myLED.endless(false);
hThreads[0] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[1]);
hThreads[2] = CreateThread(NULL,0,&(led_stripeDown), &myLED, NULL, &id[2]);
hThreads[3] = CreateThread(NULL,0,&(daq_VCtest35), &myDAQ, NULL, &id[3]);
waiter = WaitForMultipleObjects(MAX_THREADS,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS+1; k++) //Max_threads hier = 4
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(42);
nameincrement=true;
close();
}
void CTRL::MT_VC_hiNoS(bool mode, int modeswdel1, int modeswdel2) // rm 43 AIn & high steps
{ // automatic SEC ctrl (VC)
init();
myDAQ.setrecduration(9); // recduration
myDAQ.lang();
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC operation mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
hThreads[0] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[1]);
hThreads[2] = CreateThread(NULL,0,&(daq_VCtest35), &myDAQ, NULL, &id[2]);
waiter = WaitForMultipleObjects(MAX_THREADS-1,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS-1; k++) //Max_threads hier = 3
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(43);
nameincrement=true;
myDAQ.langoff();
close();
}
void CTRL::MT_VC_rampStr(bool mode, int modeswdel1, int modeswdel2) // rm #44 stripes, AIn + rampOut
{ // automatic SEC ctrl (VC)
init();
myDAQ.setrecduration(8); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC operation mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
myLED.endless(false);
hThreads[0] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[1]);
hThreads[2] = CreateThread(NULL,0,&(led_stripeDown), &myLED, NULL, &id[2]);
hThreads[3] = CreateThread(NULL,0,&(daq_VCramp), &myDAQ, NULL, &id[3]);
waiter = WaitForMultipleObjects(MAX_THREADS,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS+1; k++) //Max_threads hier = 4
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(44);
nameincrement=true;
close();
}
void CTRL::MT_VC_rampNoS(bool mode, int modeswdel1, int modeswdel2) // rm #45 AIn + rampOut
{ // automatic SEC ctrl (VC)
init();
myDAQ.setrecduration(8); // recduration
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2); // SEC operation mode
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
hThreads[0] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[1]);
hThreads[2] = CreateThread(NULL,0,&(daq_VCramp), &myDAQ, NULL, &id[2]);
waiter = WaitForMultipleObjects(MAX_THREADS-1,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS; k++) //Max_threads hier = 3
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(45);
nameincrement=true;
close();
}
void CTRL::MT_P_rec(bool mode, int modeswdel1, int modeswdel2) // rm #50
{ // automatic SEC ctrl (VC)
init();
myDAQ.setrecduration(10);
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2);
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
hThreads[0] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[1]);
hThreads[2] = CreateThread(NULL,0,&(daq_Papply), &myDAQ, NULL, &id[2]);
waiter = WaitForMultipleObjects(MAX_THREADS,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS; k++) //Max_threads hier = 3
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(50);
nameincrement=true;
close();
}
void CTRL::MT_CStep(bool mode, int modeswdel1, int modeswdel2) //rm 60
{ // automatic SEC ctrl (VC)
init();
myDAQ.setrecduration(10);
myDAQ.preReadIn();
myLED.SECpara(mode, modeswdel1, modeswdel2);
myDAQ.SECpara(mode, modeswdel1, modeswdel2);
hThreads[0] = CreateThread(NULL,0,&(led_SECctrl), &myLED, NULL, &id[0]);
hThreads[1] = CreateThread(NULL,0,&(daq_readIn), &myDAQ, NULL, &id[1]);
hThreads[2] = CreateThread(NULL,0,&(daq_cstep), &myDAQ, NULL, &id[2]);
waiter = WaitForMultipleObjects(MAX_THREADS,hThreads,TRUE,INFINITE);
for (int k = 0; k < MAX_THREADS; k++) //Max_threads hier = 3
{
CloseHandle(hThreads[k]);
}
myDAQ.writeLog(60);
nameincrement=true;
close();
}
void CTRL::P_adjust()
{
init();
myDAQ.Padjust();
myDAQ.Papply();
nameincrement=false;
close();
}
void CTRL::P_apply()
{
init();
myDAQ.Papply();
nameincrement=false;
close();
}
void CTRL::CS_adjust()
{
init();
myDAQ.Padjust();
myDAQ.cstep();
nameincrement=false;
close();
}
void CTRL::CStep()
{
init();
myDAQ.cstep();
nameincrement=false;
close();
}
void CTRL::prefs()
{
myDAQ.prefs();
}
void CTRL::tellprefs()
{
myDAQ.gimmePrefs();
}
void CTRL::openclose()
{
close();
myDAQ.schliessen();
cout<<"Closing down entire DAQ board - grand reopening soon!"<
myDAQ.initGeneral();
init();
cout<<"initialized again"<
close();
cout<<"all subsys closed!"<
}
void CTRL::oops()
{
init();
cout<<"Ooops!"<
for (int i=0; i<15;i++)
{
myLED.testbild();
Sleep(i*8);
myLED.LEDreset();
Sleep(i*8);
}
close();
}
void CTRL::about()
{
MessageBox ( NULL, "Ulrich Beckers 2004-2009 -- visit http://via.i-networx.de/BlueIO/about.htm", "About", MB_ICONINFORMATION);
cout<
<<"* About:"<
<<"* Version: "<
<<"* Tinkered and cobbled @ Bielefeld University 2004-2009"<
<<"* by Ulrich Beckers"<
<<"* www.via-altera.de"<
<<"* ... and remember this is always in beta!"<
<<"*******************************************************************"<
nameincrement= false;
init();
myLED.bout();
close();
}
#endif
back to the code manual page
back to the Blue IO main page
back to main page and contact information
--
latest change: 26-08-2009 -- (c) U. Beckers
|