Esempio n. 1
0
/** This function is called when the player is playing a song
 and there is free processor time. The basic task of this
 function is to implement the player user interface. */
void AvailableProcessorTime()
{

	do
	{
  		CheckKey();
  
 		 //IPODCommandProcess();
		 
		if(0 == playStop)
		{
			GREEN_LED_ON();
		}	
	}while(0 == playStop);
	
  	//do other things
	ControlLed();

}
Esempio n. 2
0
    int main(void)
    {
	unsigned char Arg0;
 



//if DDRX,X=1 PORTX,X=OUT
    DDRA=0x61;
	PORTA = 0xff;//0xc0 prov

    DDRB=0x68;
	PORTB = 0xff;

    DDRC=0xfc;
    PORTC =0xff;

    DDRD=0xfe;
    PORTD=0xf7;
	TCCR2=0;
	TCCR1A=0;
	TCCR0=0;
//INIT TWI;
    TWBR=0x7f;//F TWI


    TCCR1B=0x2;//0.5mkc
    TIMSK=TIMSK | 0x4;//enable Int overlowT1
    TWAR=(NumberLink<<1)+4;   
   TWCR =(1<<TWEA)|(1<<TWEN);

   _SEI();



		
	for(Arg0=1;Arg0<=10;++Arg0)
	RomReceive[Arg0]=0;


	CtEeprom=1;

	RegimWork=0x10;//avt vent
	CtErrorLink=CtErrorLink0;
	CtKn=5;

			
	ResetError();	
//WORK	
	           
      while(1)
    {
	_WDR();
	if(RomReceive[3] & 0x1)
	ResetError();
	SetError();
	SetRegimError();


	ControlRegim();
	ControlPech();
	if(RomReceive[1] & 1)
	OpenLuk1();
	else if(RomReceive[2] & 1)
	CloseLuk1();
	else
	PORTC |=0xc;
	if(RomReceive[1] & 2)
	OpenLuk2();
	else	if(RomReceive[2] & 2)
	CloseLuk2();
	else
			{
	PORTC |=0x10;
	PORTB |=0x8;
			}



	ControlLed();
	ControlRevun();
	if(EnableLoad)
		{
    LoadRegTransmit();
    LoadControlSum();
		}
	if(TWCR & 0x80)
			{
    ReceiveTransmitSlave();
	++TestTransmit;
			}
	if(!CtErrorLink)//ErrorLink;
		{

//INIT TWI;
    TWBR=0;//F TWI
   TWAR=0;
   TWCR =0;
	TWSR=0xf8;
    CtStart=50;
	while(CtStart--)	_WDR();
    TWBR=0x7f;//F TWI
    TWAR=(NumberLink<<1)+4;
   TWCR =(1<<TWEA)|(1<<TWEN);
 //   TWCR |=(1<<TWINT);
	CtErrorLink=CtErrorLink0;

    CtStart=200;
	while(CtStart--)	_WDR();
		}



				

    }
  
}