here is the code. enjoy.
#include
#include "gpio.h"
#define LED_PORT P2
#define LED_DDR P2
#define LED_PINs 0xff //led connected to P3.0 -> P3.7
#define LED_ON(val) IO_CLR(LED_PORT, val) //output val on led_port
#define LED_OFF(val) IO_SET(LED_PORT, val) //clear val
#define DIG_PORT P3
#define DIG_DDR P3
#define DIG0 (1<<0) //digit 0 on P3.0
#define DIG1 (1<<3) //digit 1 on P3.3
#define DIG2 (1<<7) //digit 2 on P3.7
#define DIGs (DIG0 | DIG1 | DIG2)
#define DIG_ON(digs) IO_CLR(DIG_PORT, digs) //turn on digs
#define DIG_OFF(digs) IO_SET(DIG_PORT, digs) //turn off digs
unsigned char val_disp=90; //value to be displayed. 00..99
unsigned char dig_disp=0; //dig to be displayed. 0 or DIG_MAX
//a simple multi-tasking OS
//each task has a pre-define time slot (XOS_slot), + an idle slot
//user can add up to 255 tasks (including the idle task).
//each task has to take less than the time slot to