help in making engine digital RPM meter

void loop()
{
  noInterrupts();
  unsigned long rpmToDisplay = rpm;  // take a copy with interrupts disabled in case it changes
  interrupts();
  if (rpmToDisplay >= 1000)
  {
    Serial.print(rpmToDisplay/1000);
    Serial.print(',');
    Serial.print((char)(((rpmToDisplay/100) % 10) + '0'));
    Serial.print((char)(((rpmToDisplay/10) % 10) + '0'));
    Serial.print((char)((rpmToDisplay %10) + '0'));
  }
  else
  {
    Serial.print(rpmToDisplay);
  }
  Serial.println(); 
  delay(200);
}

I've coded and tested it with Serial.print but it should work with lcd.print as well.