Go Down

Topic: Is this too big for ISR ? (Read 1 time) previous topic - next topic

WizenedEE

I managed to get 460800 baud with the uno. Above that, I would just see garbage.

You could also use Serial.write rather than print so you just print 2 bytes rather than somewhere between one and six (and you'd save another because you wouldn't need a deliminator). Then you'd have to write a program on your computer to interpret it, though

KeithRB

According to this:
http://www.arduino.cc/en/Reference/AnalogRead

An analog read takes .1 mS, so your three Analog reads take 30% of your 1 mS anyway.

FardinB

I optimized my analogRead to get the maximum speed out of it.
This page (near the bottom) shows you how to get 77 kHz reading speed out of analog read. So the analog read times is not a concern to me.
https://sites.google.com/site/measuringstuff/the-arduino

@WizenedEE
How did you manage to read that speed on the serial monitor of PC?


WizenedEE


@WizenedEE
How did you manage to read that speed on the serial monitor of PC?

Code: [Select]

screen /dev/ttyACM0 460800

I run GNU/linux

FardinB

How about this code for ISR? would it run faster?

Code: [Select]

ISR(TIMER1_COMPA_vect) {  //Interrupt at freq of 250Hz
  distance = getDistance(Lsensor);
  pressure = getPressure(Psensor);
  prSwitch = getPswitch(Pswitch);
  temp = getTemperature(tmp);
  Fldtemp = getTemperature(Fluidtmp);
 
  toprint = 0; //reset buffer
  toprint += drive;
  toprint += ' ';
  toprint += distance;
  toprint += ' ';
  toprint += pressure;
  toprint += ' ';
  toprint += prSwitch;
  toprint += ' ';
  toprint += temp;
  toprint += ' ';
  toprint += Fldtemp;
 
  Serial.println(toprint);
}


Go Up