Measuring engine rpm and displaying on LED bargrap

Ok, what im trying to do is measure engine rpm, I have 7 leds. Each led representing 1000rpm.

So for 1000rpm, 1 led is on, 2000rpm 2 leds on etc.

And at 6150rpm the last led will start flashing. Rev limit been at 6250 rpm. Maybe the last led could blink faster as I get closer to 6250 rpm ?

I adapted the code from the PC fan speed tutorial in the playground using interrupts.
By editing this:

 rpm = 20*1000/(millis() - timeold)*rpmcount;

I can change it to calculate rpm for a 6cyl 4 stroke instead of a pc fan.

I then tryed a few different things using IF statements and Cases.

 volatile byte rpmcount;
 unsigned int rpm;
 unsigned long timeold;
 int rpmcheck;
 int si1 = 3;
 int si2 = 4;
 int si3 = 5;
 int si4 = 6;
 int si5 = 7;
 int si6 = 8;
 int si7 = 9;
 
 void rpm_check()
 {
   rpmcount++;
 }


void setup()
{
attachInterrupt(0, rpm_check, RISING);
rpmcount = 0;
rpm = 0;
timeold = 0;
rpmcheck =0;
pinMode(si1, OUTPUT);
pinMode(si2, OUTPUT);
pinMode(si3, OUTPUT);
pinMode(si4, OUTPUT);
pinMode(si5, OUTPUT);
pinMode(si6, OUTPUT);
pinMode(si7, OUTPUT);
   digitalWrite(si1, HIGH);
   digitalWrite(si2, HIGH);
   digitalWrite(si3, HIGH);
   digitalWrite(si4, HIGH);
   digitalWrite(si5, HIGH);
   digitalWrite(si6, HIGH);
   digitalWrite(si7, HIGH);
Serial.begin(9600);
}



void loop()
{
 rpm = 20*1000/(millis() - timeold)*rpmcount;
     timeold = millis();
     rpmcount = 0;
    
  
     
     if (rpm < 1000)
       {
         rpmcheck = 1;
       }
       else if (rpm > 1000)
       {
         rpmcheck = 2;
       }
       else if (rpm > 2000)
       {
         rpmcheck = 3;
       }
       else if (rpm > 3000)
       {
         rpmcheck = 4;
       }
       else if (rpm > 4000)
       {
         rpmcheck = 5;
       }
       else if (rpm > 5000)
       {
         rpmcheck = 6;
       }
       else if (rpm > 6000)
       {
         rpmcheck = 7;
       }
       else if (rpm > 6200)
       {
         rpmcheck = 8;
       }
       
       switch (rpmcheck) {
         case 1: // Less than 1000 rpm
           digitalWrite(si1, HIGH);
           digitalWrite(si2, HIGH);
           digitalWrite(si3, HIGH);
           digitalWrite(si4, HIGH);
           digitalWrite(si5, HIGH);
           digitalWrite(si6, HIGH);
           digitalWrite(si7, HIGH);
           break;
         case 2: // Over 1000 rpm
           digitalWrite(si1, LOW);
           digitalWrite(si2, HIGH);
           digitalWrite(si3, HIGH);
           digitalWrite(si4, HIGH);
           digitalWrite(si5, HIGH);
           digitalWrite(si6, HIGH);
           digitalWrite(si7, HIGH);
           break;
         case 3: // Over 2000 rpm
           digitalWrite(si1, LOW);
           digitalWrite(si2, LOW);
           digitalWrite(si3, HIGH);
           digitalWrite(si4, HIGH);
           digitalWrite(si5, HIGH);
           digitalWrite(si6, HIGH);
           digitalWrite(si7, HIGH);
           break;
          case 4: // Over 3000 rpm
           digitalWrite(si1, LOW);
           digitalWrite(si2, LOW);
           digitalWrite(si3, LOW);
           digitalWrite(si4, HIGH);
           digitalWrite(si5, HIGH);
           digitalWrite(si6, HIGH);
           digitalWrite(si7, HIGH);
           break;
          case 5: // Over 4000 rpm
           digitalWrite(si1, LOW);
           digitalWrite(si2, LOW);
           digitalWrite(si3, LOW);
           digitalWrite(si4, LOW);
           digitalWrite(si5, HIGH);
           digitalWrite(si6, HIGH);
           digitalWrite(si7, HIGH);
           break;
          case 6: // Over 5000 rpm
           digitalWrite(si1, LOW);
           digitalWrite(si2, LOW);
           digitalWrite(si3, LOW);
           digitalWrite(si4, LOW);
           digitalWrite(si5, LOW);
           digitalWrite(si6, HIGH);
           digitalWrite(si7, HIGH); 
           break;
          case 7: //Over 6000 rpm
           digitalWrite(si1, LOW);
           digitalWrite(si2, LOW);
           digitalWrite(si3, LOW);
           digitalWrite(si4, LOW);
           digitalWrite(si5, LOW);
           digitalWrite(si6, LOW);
           digitalWrite(si7, HIGH);
           break;
          case 8: // Over 6200 rpm
           digitalWrite(si1, LOW);
           digitalWrite(si2, LOW);
           digitalWrite(si3, LOW);
           digitalWrite(si4, LOW);
           digitalWrite(si5, LOW);
           digitalWrite(si6, LOW);
          digitalWrite(si7, LOW);
          break;
       }
   
}

The led pins are si1, si2, si3 etc.
They are pulled low because of the way they are wired. ie, digitalWrite(si7, LOW); will turn the led 7 on.

I havent yet had it measuring rpm (still having hardware troubles).

I also tryed some code using only IF statements ie.

If (rpm > 1000)
{
            digitalWrite(si1, LOW);
           digitalWrite(si2, HIGH);
           digitalWrite(si3, HIGH);
           digitalWrite(si4, HIGH);
           digitalWrite(si5, HIGH);
           digitalWrite(si6, HIGH);
           digitalWrite(si7, HIGH);
}
else if (rpm > 2000)
{
           digitalWrite(si1, LOW);
           digitalWrite(si2, LOW);
           digitalWrite(si3, HIGH);
           digitalWrite(si4, HIGH);
           digitalWrite(si5, HIGH);
           digitalWrite(si6, HIGH);
           digitalWrite(si7, HIGH);
}

etc etc.

At the start of the code i just set a varible called rpm and set it to 2000rpm to test it (since i dont have hardware side sorted out yet)
But it lit 3 leds instead of 2.

And 4 leds instead of 3 etc, basically just indicated 1000rpm higher than acutal.

Anyway im sure there is a quicker more efficient way of doing what I want to do, I just cant think of it.

Any input would be greatly appreciated.

I quickly made a program that showed what I would like the leds to do and videoed it.

http://orac.e30nz.com/DSCF2188.AVI