I have this simple program:
int fb;
int fc;
signed long int Rs;
while (1)
{
fb = 400;
fc = 2;
Rs = fb/fc;
delay (20);
UDR = 0xf0;
while (!(UCSRA & (1<<UDRE)));
UDR = Rs;
while (!(UCSRA & (1<<UDRE)));
Rs <<= 8;
UDR = Rs;
}
and the port receives:
0xf0
240 136 000
240 200 000
240 136 000
240 200 000
240 200 000
240 200 000
I don´t know why 136 appears all the time. The result should be 200. I write this program because I´m not able to understand whats happening with divisions.
Thank you in advance