Esempio n. 1
0
void System_SetAutoSendInterval( int interval )
{
  System_SetActive( 1 );
  if( interval < 0 || interval > 5000 )
    return;
  else
  {
    if( System->autoInterval != interval )
    {
      System->autoInterval = interval;
      Eeprom_Write( EEPROM_OSC_ASYNC_INTERVAL, (uchar*)&interval, 4 );
    }
  }
}
Esempio n. 2
0
void System_SetAsyncDestination( int dest )
{
  System_SetActive( 1 );
  if( dest < ASYNC_INACTIVE || dest > (OSC_CHANNEL_COUNT-1) )
    return;
  else
  {
    if( System->asyncDestination != dest )
    {
      System->asyncDestination = dest;
      Eeprom_Write( EEPROM_OSC_ASYNC_DEST, (uchar*)&dest, 4 );
    }
  }
}
Esempio n. 3
0
/**
	Gives the board a name.
  The name must be alpha-numeric - only letters and numbers.  It can help you
  determine one board from another when there are more than one connected to 
  your system.
  @param name A string specifying the board's name
	@return 0 on success.
	
	\b Example
	\code
	// give the board a special name
	System_SetName("my very special controller");
	\endcode
*/
int System_SetName( char* name )
{
  System_SetActive( 1 );
  int length = strlen( name );
  if( length > SYSTEM_MAX_NAME )
    return CONTROLLER_ERROR_STRING_TOO_LONG;
  
  strcpy( System->name, name ); // update the name in our buffer
  int i;
  char* ptr = name;
  for( i = 0; i <= length; i++ ) // have to do this because Eeprom_Write can only go 32 at a time.
  {
    Eeprom_Write( EEPROM_SYSTEM_NAME + i, (uchar*)ptr++, 1 );
  }

  return CONTROLLER_OK;
}
Esempio n. 4
0
/**
	Sets the Serial Number. 
	Note that this can be changed by the user at 
  any time, but that it is used in the \ref Network subsystem to form the last 
  two bytes of the network MAC address, so ideally units on the same network
  should have unique serial numbers.
	@return 0 on success.
	
	\b Example
	\code
	// set the serial number to 12345
	System_SetSerialNumber(12345);
	\endcode
*/
int System_SetSerialNumber( int serial )
{
  serial &= 0xFFFF;
  return Eeprom_Write( EEPROM_SYSTEM_SERIAL_NUMBER, (uchar*)&serial, 4 );
}
Esempio n. 5
0
void main()
{
     b=1;
     trisb = 0b00001111;
     trisc = 0b10000000;
     portc = 0;
     ///////////// Store The Password(12345) //////////
     Eeprom_Write(0x00,1);
     Eeprom_Write(0x01,2);
     Eeprom_Write(0x02,3);
     Eeprom_Write(0x03,4);
     Eeprom_Write(0x04,5);
     //////////////////////////////////////////
     Lcd_Init(&portd);
S:   Lcd_Cmd(Lcd_Clear);
     Lcd_Out_Cp("Ent Pass:"******"*");
                            delay_ms(700);

                do{
                                    K = Key_Read();
                            }
                while(k==20);
               // Lcd_Out_Cp("*");
                if(k==10)

                {
    ////////////// Detection Process /////////////////////
                
                for(i = 0;i <= 4;i++)
                {
                  if(sum==0) sum = sum + (Eeprom_Read(i) - Eeprom_Read(i + 5));
                }

                if(sum == 0){ b=1;
                              Lcd_Out(2,1,"OPEN");

                              portc=1;

                              //do
                              //{
                              for(x=1000 ; x>2; x--)
                              {
                              delay_ms(10);
                              PORTC=PORTC<<1;
                              if (PORTc.F4) PORTC=1;
                              

                              }
                              delay_ms(5000);
                              for(x=1000; x>2; x--)
                              {
                              delay_ms(10);
                              PORTC=PORTC>>1;
                              if (PORTC==0) PORTc=8;
                               }
                               for(a=0;a<5;a++)
                               { Eeprom_Write(a+5,19);
                                }
                               goto S;

                            }
                else {
                        Lcd_Out(2,1,"ERORR");
                        b++;
                         delay_ms(500);
                       if(b==4){
                              while(1){delay_ms(500); Lcd_Out(2,1,"LOCKED"); }}
                        
                      } }   }