Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[AVR] Usart not receive fingerprint Module R305 response in atmega32

Status
Not open for further replies.

bhura112

Newbie level 2
Joined
Apr 13, 2016
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Delhi
Activity points
9
Hay Friends..
I am using Fingerprint Module R305 ,when i transmit GenImg[12],seach[] to fingerprint module by atmega32 it's work properly but if i save response of R305 module it's not receive and micro controller waiting for incoming data ... I am confused what i do
....Plsz frdsz help me:oops::oops::oops::oops:

- - - Updated - - -

my simple code

Code:
#include<avr/io.h>
#include<util/delay.h>
#include<avr/interrupt.h>
#include"lcd_4.h"


unsigned char res[50];
void UART_init(unsigned int);
void send_data(unsigned char data)
{
	    UDR=data;
		while((UCSRA&(1<<TXC))==0);
		UCSRA|=0X40;
}

char ReadData( void )
{
	while(!(UCSRA & (1<<RXC)))
	{
	}
	return UDR;
}


int main()
{
  int i=0,count=0,j=0; char k,ch;
  unsigned char vfyPsw[17]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x07,0x13,0x00,0x00,0x00,0x00,0x00,0x1B};
  unsigned char genImg[12]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x03,0x01,0x00,0x05};
  unsigned char im1[14]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x04,0x02,0x01,0x00,0x08};
  unsigned char im2[14]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x04,0x02,0x02,0x00,0x09};
DDRC=0x00;DDRD=0x02;
DDRB=0xff;
linit();
UART_init(9600);

 lcmnd(0x01);
 lstr("Password vryfy");
 for (i=0;i<17;i++)
 {
	 send_data(vfyPsw[i]);
	 _delay_ms(10);
 }
 _delay_ms(10000);
while(1)
 {   
  if(PINC&(0x01)==0x01){
			while(1){
				lcmnd(0x01);
		             lstr("Put your 1Finger");
		   for (i=0;i<12;i++)
		   {
			   send_data(genImg[i]);
			   _delay_ms(10);
		   }
		   for (i=0;i<12;i++)
		   {
			   res[0]=ReadData();
		   }
		   if (res[11]=0x0a)
		   {
			   lcmnd(0x01);
			   lstr("Remove your Finger");
			   break;
			   _delay_ms(1000);
		   }
			}   //internal while(1) close
		}
	}
}


void UART_init(unsigned int baudrate)
{
UBRRH=0X00;
UBRRL=51;
//UCSRA=(1<<U2X);
UCSRB=(1<<RXEN)|(1<<TXEN);
UCSRC=(1<<URSEL)|(1<<UCSZ0)|(1<<UCSZ1);
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top