ISR compilation problems

Hi to everybody,
I trying to compile the code attached below but i have an error message in ISR declaration row (if I change with AttachInterrupt I've the same error)

#define COMINGUPSPEED 1.25  
#define LENGTH 228 
#define STEP ((2*3.14159)/1436)*LENGTH 
#define RPS (STEP/(60*0.2549))/COMINGUPSPEED 
#define ZERO_SPEED 65535
#define STEPS_PER_REV 3200     
#define MAX_RPM (RPS*60.0)   


#define CLR(x,y) (x&=(~(1<<y)))
#define SET(x,y) (x|=(1<<y))

uint16_t rpm;
float rpm;
uint16_t period;
uint16_t userCommand=0;
uint8_t motor_enable;

// TIMER 1: STEP INTERRUPT
ISR(TIMER1_COMPA_vect)
{
  if (motor_enable)
    {
    SET(PORTB,4);
    delayMicroseconds(2);
    CLR(PORTB,4);
    }
}

void setRpm()
{
  float temp;
  if (rpm == 0)
  {
    ICR1 = ZERO_SPEED;
    digitalWrite(10,HIGH);  // Disable motor
  }
  else
  {
    digitalWrite(10,LOW);  // Enable motor
 /*   if (rpm<8)
      rpm = 8;*/
    if (rpm>MAX_RPM)
      rpm = MAX_RPM;
    temp = (rpm/60.0)*STEPS_PER_REV;
    temp = 2000000 / temp;          //  2000000 = (16000000/8) timer1 16Mhz with 1/8 preescaler
    if (period<600000)
      period=60000;
    period = temp;
    while (TCNT1 < 30);   // Wait until a pulse to motor has finished
    //cli();
    ICR1 = period; //+ userCommand;
    if (TCNT1 > ICR1)     // Handle when we need to reset the timer
      TCNT1=0;
    //sei();
  }
}

void setup()
{

  pinMode(7,OUTPUT);    // LED pin
  pinMode(8,OUTPUT);    // STEP pin
  pinMode(9,OUTPUT);    // DIR pin
  pinMode(10,OUTPUT);   // ENABLE pin

  // Button input with pullups enable
  pinMode(4,INPUT_PULLUP);
  pinMode(5,INPUT_PULLUP);
  pinMode(6,INPUT_PULLUP);

  digitalWrite(10,HIGH);  // Disable motor
  digitalWrite(9,HIGH);    // Motor direction

  Serial.begin(115200);

  digitalWrite(7,HIGH);
  delay(200);    // Initial delay
  Serial.println("ArduPOV MOTOR Stepper motor driver v1.0");
  digitalWrite(7,LOW);

  motor_enable = 0;

  // PWM SETUP
  // Fast PWM mode => TOP:ICR1
  TCCR1A =(1<<WGM11);           
//  TCCR1B = (1<<WGM13)|(1<<WGM12)|(1<<CS10);   //No Prescaler, Fast PWM
   TCCR1B = (1<<WGM13)|(1<<WGM12)|(1<<CS11);   // Prescaler 1:8, Fast PWM
  ICR1 = ZERO_SPEED;
  TIMSK1 = (1<<OCIE1A);  // Enable Timer interrupt

  rpm = 0;

  while (digitalRead(4)==HIGH);    // Wait until START button is pressed
  motor_enable = 1;
  delay(250);
  while (digitalRead(4)==LOW);
}

void loop()
{ 
  if (digitalRead(4)==LOW)   // START/STOP Button pressed?
    {
    rpm = 0;
    userCommand=0;
    setRpm();
    if (motor_enable == 1)
      motor_enable = 0;
    else
      motor_enable = 1;
    while (digitalRead(4)==LOW);   // Wait until botton release
    }

  if (digitalRead(6)==LOW)   //  Button 3 pressed?
  {
         Serial.println("Coming back");

        digitalWrite(9,HIGH);    // Motor direction

          rpm=50; 
        setRpm();

        if (motor_enable == 1)
    motor_enable = 0;
  else
    motor_enable = 1;

  while (digitalRead(6)==LOW);   // Wait until botton release
  }


  if (motor_enable)
    {
    rpm++;
    digitalWrite(7,HIGH);
    }
  else
    {
    rpm = 0;
    digitalWrite(7,LOW);
    }
  Serial.print("RPM:");
  Serial.print(rpm);
  Serial.print(" ");
  Serial.println(period+userCommand);
  setRpm();
    Serial.print("100xRPS large gear:");
    Serial.print(RPS/0.2549);
    Serial.print(" ");
    Serial.print("STEP:");
    Serial.print(STEP);
    Serial.print(" ");
  delay(10);

  if (digitalRead(5)==LOW)   // Decrease button
    {
    digitalWrite(7,LOW);
    userCommand--;
    while (digitalRead(5)==LOW);  // Wait until released
    }
  if (digitalRead(6)==LOW)   // Increase button
    {
    digitalWrite(7,LOW);
    userCommand++;
    while (digitalRead(6)==LOW);  // Wait until released
    }
}
uint16_t rpm;
float rpm;

You are declaring the rpm variable twice. That is the omly error reported when I compile the program that you posted

UKHeliBob:

uint16_t rpm;

float rpm;



You are declaring the rpm variable twice. That is the omly error reported when I compile the program that you posted

I have problems on ISR line and in C when you decalre two variabiles with different type but same name you haven't problem. And i did a little mistake in my original code the int rpm is commented

in C when you decalre two variabiles with different type but same name you haven't problem.

So, are you saying that it is OK to do this to declare 2 variables of the same name ?

int x;
byte x;
pinMode(7,OUTPUT);    // LED pin
  pinMode(8,OUTPUT);    // STEP pin
  pinMode(9,OUTPUT);    // DIR pin
  pinMode(10,OUTPUT);   // ENABLE pin

If you gave the pins names, you wouldn't need the stupid comments.

What board are you compiling for? I don't think that ISR() is defined in the ESP8266 core, for example.