how to use internal PLL in arduino, How to reduce processing time

Hi, i am using arduino micro. i am using internal clock only, not using any crystal. now my program needs to respond to a serial query in less than 5ms. but my code takes 15ms. I am using polling method only.

i get all inputs to my arduino via serial only. So if i go for interrupt, Upon receiving an char in serial i have to ensure that the request to be served even if another char comes in. so inside every condition i need to disable interrupt , upon coming out i need to enable. but i dont have idea on how to do that. So tell me how to do that? Please any suggestion to reduce time

my code looks like follows,..

void setup() { Serial.begin(9600); } void loop { if(Serial.available>0) { char Input = Serial.read(); } if(Input == 'a') { // process 1 } if(Input =='b') { //process 2 } }

alagappan: void setup() { Serial.begin(9600); Serial.begin(115200); }

If the other side is capable of sending (so much) faster.

if(Serial.available>0)

Oops.

Please remember to use code tags when posting code

It's the code you did not post that is causing the problem.

Mark

This piece of code is very buggy:

if(Serial.available>0)
{
char Input = Serial.read(); //makes Input known only within this block!
  //do all input processing here
}
//if(Input == 'a') //move all that stuff into above block

And don't disable interrupts unless really required, to access volatile variables. Else you'll miss all characters arriving while interrupts are disabled.