AT90S2313-Encryption
The objective of this project is to provide a simple encryption to the data received by the input port(PORTB) and after encryption the data is send through PORTD.
The program is as shown:
#include AT90S2313.h
int main(void)
{
unsigned char *in_port = (unsigned char*)&PINB;
unsigned char *out_port = (unsigned char*)&PORTD;
unsigned int xor_key = 0xFF;
DDRB = 0; /* set for input. */
DDRD = 0xFF; /* enable as output */
repeat:
for (; ;)
//input is xor with xor_key variable
*out_port = xor_key ^ *in_port;
goto repeat;
return 0;
}