Programming to Display RPM on a LCD

Hi
I have a robot with a single flywheel with 25:1, I am new to programming & I use easyC
I have made a program for the optical shaft encoder to display how many ticks have been counted but I need it to display the amount of revolutions that have been made when it is running.

Lets look at what we know.
RPMs are a measurement over time and an OSE ticks 360 times per revolution so we to start a timer, wait for a little bit while counting the ticks, then measure the ticks compared to the timer.

For example: If we count 18 ticks in 50 ms. (1000 / 50 [ms to seconds]) x (18[ticks]) x (60/360 [seconds per tick]) gives us 59.76 RPM.

If my math is right then the following code should work for you.

Can you post the global variables and local variables used for this code.

Thank you so much the code

Encoder and timer variables are long the rest are int. All are local variables.

I am away from a pc and can’t send a pic.

What is the x=1+2 function called

assignment

so do I need to switch the rpm and distance variables too?

So would I tell it to display motspd:%d

Yep.


SetLCDText(1,1,"MOTspeed: %d", rpm)

Hey.
Do you mind reposting the code?
It says the image failed to load.