RPM = ((1024 - ( ADRESH:ADRESL))* RPMmax) /1024

depending on the processor used, you'll need to use or PBPL(ongs) or DIV32 ...

Alain