bhura112
Newbie level 2
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
- - - Updated - - -
my simple code
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
- - - 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);
}