Hi ;

I'm having an interesting problem with the following programme block ..

Just to note that , The program works as written and compiled with it's current form below . I'm getting RB0 interrupts on every falling edge of PORTB.0 and when the programme goes to interrupt block it just clears the TMR1 register and RB0 int. flag and waits for the next RB0 interrupt by reading the INTF(RB0 int flag) continuously . . And when the INTF goes high (RB0 interrupt occurs) thus it leaves the while wend cycles and gets the variable in the TMR1 so that I can measure a period .. As I said , I can measure and display the period with this method ... But when It comes to calculating the revolutions per minute (RPM) with the ( * ) operator in the bold written code it just goes mad and misdisplays the RPM value on the screen ..

What I wanna know is : Why the ( * ) multiplication operator doesn't work in the code below and how come the ( */ ) operator gives me the right result ??

I mean let's say , time and rpm are word variables and time=19827 (us) , you know that 1 minute equals to 60 * 10^6 (us) = which is written in the form of 6000 * 10000 (just to state them both in word format)

So : When we take ( */ ) operator the result is supposed to be

6000*/ 10000 = 234375 (since the */ gives me the middle 16 bit of the result , as if we divide the result by 256)

rpm=div32 19827

result ===> rpm=11.82 thus "11"

Both the project on breadboard and PROTEUS give me the correct result ( 3026 )

How is that possible ? and why ( * ) operand doesn't work while it is supposed to work ?

Thanks in advance !

Code:'------ DISABLE intblock: TMR1=0 INTF=0 'RB0/INT FLG WHile INTF=0 @ NOP wendtime=TMR1 rpm=6000*/10000 rpm=div32 timeINTF=0'FLG resume enable '------

## Bookmarks