void main(void) {

enum bool flag1, flag2, flag3, flag4;
uc_8 count = 0; // counter
  
Initialise(); // System initialisation
switchesInit(); // Switches initialisation
LEDsInit(); // LED initialisation
sevenSegInit(); // 7segment initialisation

flag = LEDsPut(~count); // display initial value

	for(;;) {
		if (switchesGet(&temp))
		{
			count++; //increment counter
		    flag1 = switchesGet(&temp);
		    flag2 = LEDsPut(~count);
		    flag3 = sevenSegPut(Seg1, count);
		    flag4 = sevenSegPut(Seg2, count);
		    if (count == 15)
		    {
		    	count = 0;
		    }
		}
		for (int i = 0; i < 100; ++i)
		{
			for (int j = 0; j < 1000; ++j)
			{
				// Software time delay to make operations visible
			}
		}
	} /* loop forever */
}
Esempio n. 2
0
int main(void){
    OS_Init();
    LEDsInit();
    switchesInit(&leftSwitch, &rightSwitch, SWITCH_PRIO);
    SBInit(SYS_CLK_FREQ/SBUS_FREQ, SBUS_ID, SBUS_PRIO);
    OS_AddThread(&IdleTask, 128, 7);
    OS_Launch(SYS_CLK_FREQ/OS_FREQ);
    return 0;
}