Discussion in "8051 Discussion Forum" started by    rearthur2003    Jun 15, 2009.
Mon Jun 15 2009, 02:22 am
#1
you can give it a try
#include "uart.h"
#include "uart.c"

void delay_rony(unsigned int delay_val)
{	
	int temp = 0;
	do
		{
			temp++;
		}
		while(temp<=delay_val);
}

void main(void)
{
	//int i;
	unsigned char usr1, usr2, usr3, usr4, usr5, pass1, pass2, pass3, pass4, pass5;
	while(1)
	{
	uart_init();
start:
	uart_string("******************************\n\r");
	uart_string("  8051 AUTHENTICATION SYSTEM  \n\r");
	uart_string("******************************\n\r\n\r");
	delay_rony(50000);
	uart_string("Username: ");
	usr1 = uart_receive();
	uart_send(usr1);
	usr2 = uart_receive();
	uart_send(usr2);
	usr3 = uart_receive();
	uart_send(usr3);
	usr4 = uart_receive();
	uart_send(usr4);
	usr5 = uart_receive();
	uart_send(usr5);
		if(uart_receive() == 0x0d)
			{
				if(usr1==0x61&&usr2==0x64&&usr3==0x6d&&usr4==0x69&&usr5==0x6e)
				{
				uart_string("\n\r");
				goto passwd;
				}
				else
				{
				uart_string("\n\r\n\rInvalid User!!!\n\r");
				goto start;
				}
			}
		else
			{
				uart_string("\n\r\n\rYOU HAVE EXCEEDED MAX NUMBER OF CHARS. \n\r");
			}
		}
passwd:
	uart_string("\n\rPassword: ");
	pass1 = uart_receive();
	uart_string("*");
	pass2 = uart_receive();
	uart_string("*");
	pass3 = uart_receive();
	uart_string("*");
	pass4 = uart_receive();
	uart_string("*");
	pass5 = uart_receive();
	uart_string("*");
		if(uart_receive() == 0x0d)
			{
				if(pass1==0x61&&pass2==0x64&&pass3==0x6d&&pass4==0x69&&pass5==0x6e)
				{
				uart_string("\n\r\n\rACCESS GRANTED\n\r");
				}
				else
				{
				uart_string("\n\r\n\rInvalid Password!!!\n\r");
				goto start;
				}
			}
		else
			{
				uart_string("\n\r\n\rYOU HAVE EXCEEDED MAX NUMBER OF CHARS. \n\r");
			}
		uart_receive();

}
Tags 8051 uart based authentication systemuart access system
Mon Jun 15 2009, 04:19 am
#2
Hello rearthur2003

Thanks for the post.
Could you explain a bit more about how your program is used ?.
Mon Jun 15 2009, 06:56 am
#3
This works with serial port on baud rate 4800 once connected to you will need to authenticate yourself before doing anything, it can be added to uart based code. username is admin and password is admin. hope you like it.
Tue Jun 16 2009, 07:49 pm
#4
good work
Why dont you make an application using this code, will be a good project and can help others too
 rearthur2003 like this.
Tue Jun 16 2009, 10:45 pm
#5
i am working on it, i am working on something to control doors lights in the home so i can do everything from my pc so i dont get interrupted. anyways thanks for the comment

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

SamuelSmise
Thu Apr 25 2024, 09:56 am
DustinErele
Thu Apr 25 2024, 08:44 am
ztaletpzca
Wed Apr 24 2024, 11:19 pm
IrardlPex
Wed Apr 24 2024, 08:42 pm
Charlestehed
Wed Apr 24 2024, 05:20 pm
Robertgurse
Wed Apr 24 2024, 02:43 pm
Richardedils
Wed Apr 24 2024, 04:07 am
Malcolmaccek
Wed Apr 24 2024, 01:21 am