ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
9 мая
31018 Топик полностью
mooh (26.05.2005 21:42, просмотров: 1) ответил SM на Ответ:
Ответ: можно например так:
#define NUMSEGS 7
#define NUMTIMERS 4
#define YES 1
#define NO 0

typedef struct
{
	bit repeat;
	bit active;
	int8 sign[NUMSEGS];
} item;

typedef struct
{
	int8 numCurrent
	item timers[NUMTIMERS]; 
} allitem;

allitem all;

void Up()
{
	all.numCurrent = ( numCurrent++) % NUMTIMERS;
}

void Down()
{
	all.numCurrent = ( numCurrent--) % NUMTIMERS;
}

void Start()
{
	all.timers[all.numCurrent].active = YES; 
}

void Stop()
{
	all.timers[all.numCurrent].active = NO; 
}

void Restart()
{
	...
}

void Repeat()
{
	all.timers[all.numCurrent].repeat = YES;
}

void NoRepeat()
{
	all.timers[all.numCurrent].repeat = NO;
}

void Dec(item *it)
{
	//
	for()
	{
		it->sign[..] = ...;
		...
	}
	
	...
}

#pragma interrupt Tick()
void Tick()
{
	for(int8 i=0; i