00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "pic_tick.h"
00017
00018 uns16 tick_get_count() {
00019
00020 bit my_store_gie;
00021 uns16 result;
00022
00023 my_store_gie = intcon.GIE;
00024 kill_interrupts();
00025
00026 result = tick;
00027
00028 intcon.GIE = my_store_gie;
00029 return result;
00030 }
00031
00032 uns16 tick_calc_diff(uns16 a, uns16 b) {
00033 if (a <= b) {
00034 return b-a;
00035 } else {
00036 return 65535 - a + b + 1;
00037 }
00038 }
00039
00040 void handle_tick() {
00041 tick++;
00042 }
00043
00044