Need to "kick start" this code

Hi. I am struggling with this code. I wrote a code that reads two rpm(s) from two input pulses, and converts them to a ratio.
The program runs fine until I tried to incorporate it into code to use a LCD keypad shield. The menu displays like intended but the RPMs will not run. I have tried moving the code out of the Menu A to inside the void loop, I have tried moving the code to the MainMenuDisplay, but havent had any success.
Any help would be appreciated.

#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,4,5,6,7);

int keypad_pin = A0;
int keypad_value = 0;
int keypad_value_old = 0;
char btn_push;

byte mainMenuPage = 1;
byte mainMenuPageOld = 1;
byte mainMenuTotal = 3;

const int dataINA= 2; //pulse sensor INPUT
const int dataINB= 3; //pulse sensor INPUT
const int actuatorA= 13; //actuator power when out of sync
const int actuatorB= 12; //actuator power when out of sync

unsigned long prevmillis; //to store time
unsigned long duration; //to store time difference
unsigned long lcdrefresh; //to store time for lcd to refresh

int rpmA; //RPM value
int rpmB; //RPM value
float ratioA= rpmA/rpmB;
float ratioB= rpmB/rpmA;

boolean currentstate; //current stste of pulse scan
boolean prevstate; //state of pulse in previous scan

void setup()
{
lcd.begin(16,2); //Initialize a 2x16 type LCD
MainMenuDisplay();
delay(1000);

pinMode(dataINA,INPUT);
pinMode(dataINB,INPUT);
pinMode(actuatorA,OUTPUT);
pinMode(actuatorB,OUTPUT);
prevmillis=0;
prevstate=LOW;
ratioA= rpmA/rpmB;
ratioB= rpmB/rpmA;
}
void loop()
{
btn_push = ReadKeypad();

MainMenuBtn();

if(btn_push == 'S')//enter selected menu
{
WaitBtnRelease();
switch (mainMenuPage)
{
case 1:
MenuA();
break;
case 2:
MenuB();
break;
case 3:
MenuC();
break;
}

MainMenuDisplay();
WaitBtnRelease();
}

delay(10);

}//--------------- End of loop() loop ---------------------
void MenuA()
{
// RPM Measurement
currentstate = digitalRead(dataINA); // Read pulse
if( prevstate != currentstate) // If there is change in input
{
if( currentstate == HIGH ) // If input only changes from LOW to HIGH
{
duration = ( micros() - prevmillis ); // Time difference between revolution in microsecond
rpmA = (60000000/duration); // rpm = (1/ time millis)10001000*60;
prevmillis = micros(); // store time for nect revolution calculation
ratioA= (rpmA/rpmB);
}
}
prevstate = currentstate; // store this scan (prev scan) data for next scan

// LCD Display
if( ( millis()-lcdrefresh ) >= 100)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("A=");
lcd.print(rpmA);
lcd.print(" R/");
lcd.print(ratioA);

if (ratioA>ratioB){
digitalWrite(13,HIGH);
}else{
if (ratioA<ratioB);
digitalWrite(13,LOW);
}
{
// RPM Measurement
currentstate = digitalRead(dataINB); // Read pulse
if( prevstate != currentstate) // If there is change in input
{
if( currentstate == HIGH ) // If input only changes from LOW to HIGH
{
duration = ( micros() - prevmillis ); // Time difference between revolution in microsecond
rpmB = (60000000/duration); // rpm = (1/ time millis)10001000*60;
prevmillis = micros(); // store time for nect revolution calculation
ratioB= (rpmA/rpmB);
}
}
prevstate = currentstate; // store this scan (prev scan) data for next scan
}

// LCD Display
if( ( millis()-lcdrefresh ) >= 100)
{
lcd.setCursor(0,1);
lcd.print("B=");
lcd.print(rpmB);
lcd.print(" R/");
lcd.print(ratioB);
lcdrefresh = millis();

while(ReadKeypad()!= 'L')

if (ratioA>ratioB){
digitalWrite(13,HIGH);
}else{
if (ratioA<ratioB);
digitalWrite(13,LOW);
}
}
}
}

void MenuB()
{
lcd.clear();
lcd.setCursor(4,0);
lcd.print("RIGHT +");
lcd.setCursor(5,1);
lcd.print(ratioA);

while(ReadKeypad()!= 'L')
{
//Insert Task for Menu B here

}
}
void MenuC()
{
lcd.clear();
lcd.setCursor(5,0);
lcd.print("LEFT +");
lcd.setCursor(5,1);
lcd.print(ratioB);

while(ReadKeypad()!= 'L')
{
//Insert Task for Menu C here

}
}

void MainMenuDisplay()
{
lcd.clear();
lcd.setCursor(3,0);
switch (mainMenuPage)
{
case 1:
lcd.print("Main Menu");
lcd.setCursor(2,1);
lcd.print("press select");
break;
case 2:
lcd.print("RIGHT +");
lcd.setCursor(2,1);
lcd.print("press select");
break;
case 3:
lcd.print("LEFT +");
lcd.setCursor(2,1);
lcd.print("press select");
break;
}
}

void MainMenuBtn()
{
WaitBtnRelease();
if(btn_push == 'U')
{
mainMenuPage++;
if(mainMenuPage > mainMenuTotal)
mainMenuPage = 1;
}
else if(btn_push == 'D')
{
mainMenuPage--;
if(mainMenuPage == 0)
mainMenuPage = mainMenuTotal;
}

if(mainMenuPage != mainMenuPageOld) //only update display when page change
{
MainMenuDisplay();
mainMenuPageOld = mainMenuPage;
}
}

char ReadKeypad()
{
/* Keypad button analog Value
no button pressed 1023
select 741
left 503
down 326
up 142
right 0
*/
keypad_value = analogRead(keypad_pin);

if(keypad_value < 100)
return 'R';
else if(keypad_value < 200)
return 'U';
else if(keypad_value < 400)
return 'D';
else if(keypad_value < 600)
return 'L';
else if(keypad_value < 800)
return 'S';
else
return 'N';

}

void WaitBtnRelease()
{
while( analogRead(keypad_pin) < 800){}
}

LCDs are very slow devices and can upset critical timining
to measure pulse width, period, etc I would us e an arduino Due with the tc_lib library

also use code tags

Is probably possible to do this with interrupts and still have it work on Uno/Mega. It may not be possible as he has done without interrupts.

Why do you have the RPM measuring code mixed in with the display handling code? Shouldn't the RPM measuring be a separate function called from loop?

"Why do you have the RPM measuring code mixed in with the display handling code? Shouldn't the RPM measuring be a separate function called from loop?"

I found a rpm code example and modified it.
Please understand, I am new to arduino programming.
The rpm code runs fine until I try to add the additional pages for the LED keypad.
I did try to put the "rpm measurement" portion in the loop, and then the LED portion in the Menu A. But everything I have tried so far has not helped. It acts like the inputs are disconnected.

But everything I have tried so far has not helped.

So, now it is time to structure your code properly.

Find a few lines of code that you understand, that do one thing, like measure RPM. Create a function to do that, and move the code into the function. Call the function where the code was.

When loop() is 25 lines of code, it is far easier to see what the program is doing, even though most of the work is done elsewhere.

What you will see, when you do this, is that you measure RPM inside the block of code that happens only periodically, when it is time to update the LCD. Now, does that make sense? Not to me, and not to DrAzzy.

Meaningful names are way better than stupid names. MenuC() is a stupid name. No one could guess just what the heck menu C is and what that function is supposed to do with it. For all I know, its the child's lunch menu, and the function is supposed to raise the prices.

Thanks Ill give that a shot.