Hello, I have an arduino code with below sections.
Section I
void Setup()
{
cli();
TCCR1A = 0;
TCCR1B = 0;
TIMSK1 |= (1 << TOIE1);
TCNT1= PRELOAD;
TCCR1B |= (1 << CS11);
TCCR1B |= (1 << CS10);
sei();
}
ISR(TIMER1_OVF_vect)
{
TCNT1=PRELOAD;
count++;
count2++;
if (count>10)
{
myDisplay.DisplayString(tempString, 0);
count = 0;
}
if(count2>604800)
{
delSMS();
count2 = 0;
}
}
Section II
void serialEvent()
{
while (Serial.available()>0)
{
char lastChar = (char)Serial.read();
IncomingData += lastChar;
int len =strlen(IncomingData.c_str());
char *p=IncomingData.c_str();
p[len-1]=’\0’;
IncomingData = p;
}
}
When the code is running, some serial readings are missing. But if I remove the first section from my code, that serial data reads well. What happens in this case. Please suggest the solution for this matter.