Friday, August 17, 2012

simple Secure data transmission using AT89C51


//--- data encryption and decryption---//
//--- same program for receiver and transmitter
#include<reg51.h>
sfr in=0x80;
sfr out=0x90;
void delay(void);
void main()
{
  in=0xFF;
  out=0x00;
  while(1)
  {
   unsigned int i,p1,seq,p2;
   p1=in;
   seq=~p1;
   p2=seq^0x55;
   out=p2;
   for(i=0;i<10;i++)
   {
   delay();
   }
   }
}
 void delay(void)
 {

  TMOD=0x10;
  TL1=0xFD;
  TH1=0x4B;
  TR1=1;
  while(TF1==0);
  TF1=0;
  }