Look into the time functions in timer.h for ways to do the counters. If you need help in other areas, please be specific.