@ bperrybap:
Thank you very much for your response.
Here is a description of overall system:
first I switch a hydraulic valve, then I drive a "motor" for 300 to 500 ms. This motor is not a conventional motor and its temperature changes from room to 100 deg C during power on and then back down to room temp. This is why I need a fast DAQ. During the time when the motor is being driven, I have to monitor 5 sensor: PressureSensor, LinearSensor, PressureSwitch, MotorTemp, and FluidTemp. I have to monitor these sensor on a millisecond period. There are also some control structure here which makes the system complicated a bit.
- The system gets activated by a pushbotton.
- before driving the system I have to checkLimits. this means check that pressure, linear and motor temperature are below their max value. These sensors all have analogRead functions.
- Once everything is normal (no max detected), I drive the motor. datalogging starts here for all sensors on a ms period.
- during a timed system drive of 300 to 500 ms, I have to checkLimits continuously, to make sure the sensor values do not go over their max values.
- at some point either the timed driving is going to end or the sensor will cause the system drive to stop.
- after this I have to datalog for 3 more seconds
Code snipets:
This is checkLimits:
int checkLimits() {
if( getTemperature(tmp) >= MAXtmp )
{
return 0;
} else if( analogRead(Psensor) >= MAXpressure )
{
return 0;
}
else if( analogRead(Lsensor) >= MAXdistance )
{
return 0;
} else { return 1; }
}
This is for timed while loop:
unsigned long i = millis() + MAXtime;
while( i >= millis() )
{
// timed code here
// Ckeck Limits
if(checkLimits() == 0) { break; }
}
Please give ideas on how to do all this.
Thanks