La funzione button_counting è:

unsigned char button_counting (int i) {
unsigned char displayed ;
ssprintf(displayed, "%d", i);
return dispayed;
}