I wonder that could somebody help me.

I need a program which reads information (example temperature) as bits, and alarms if it has risen enough compared to the last result.
I mean that, it allows little rises, like 1-4 degrees, but if it rises 5 degrees at once, then the program should alarm.

I think it is pretty simple, but i have no idea how to do it.