Microcontroller › AVR › finger print module R303a
- This topic has 1 reply, 2 voices, and was last updated 6 years, 3 months ago by
GANEEV SINGH.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
March 15, 2015 at 3:13 pm #3554
Shubham Chauhan
ParticipantI am new in programming in C I am working on the project of fingerprint module R303a interfacing with atmega16. I made a code(not completed just to store image) but nothing seems to happen my code is this . Please help me
#define F_CPU 1000000UL#include<avr/io.h>#include<util/delay.h>#include"LCD_DISPLAY.H"#include"LCD_DISPLAY.C"#include<avr/io.h>int usart_init( baurd_rate){UBRRL = (F_CPU/(16*baurd_rate))-1;//UBRRL=0x33;UCSRC=(1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0);UCSRB=(1<<RXEN)|(1<<TXEN);}unsigned char i=0,fp[20],rec,dummy;unsigned char enroll[12]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X01,0X00,0X05};unsigned char generate_ch[13]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X04,0x02,0X01,0X00,0X08};unsigned char store[11]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X06,0X06,0X01};unsigned char identify[12]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X11,0X00,0X15};void USART_Transmit( unsigned char data ){/* Wait for empty transmit buffer */while ( !( UCSRA & (1<<UDRE)) );/* Put data into buffer, sends the data */UDR = data;}unsigned char USART_Received( void){/* Wait for data to be received */while ( !(UCSRA & (1<<RXC)) );return UDR;}int main(){again:init_LCD();usart_init;print_lcd(0x80,"enroll");_delay_ms(3000);lcd_clr();i=0;while(i<12){USART_Transmit (enroll);i++;}rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();dummy=USART_Received();dummy=USART_Received();if(!rec){print_lcd(0x80,"enroll kk");_delay_ms(2000);}else{print_lcd(0x80,"enroll not ok");_delay_ms(2000);}i=0;while(i<13){USART_Transmit (generate_ch);i++;}rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();dummy=USART_Received();dummy=USART_Received();if(!rec){print_lcd(0x80,"gen char ok");_delay_ms(2000);}else{print_lcd(0x80,"gen char notok");_delay_ms(2000);goto again;}i=0;while(i<11){USART_Transmit (store);i++;}rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();rec=USART_Received();dummy=USART_Received();dummy=USART_Received();if(!rec){print_lcd(0x80,"store ok");_delay_ms(2000);}else{print_lcd(0x80,"store notok");_delay_ms(2000);}}December 26, 2016 at 2:23 pm #14295GANEEV SINGH
ParticipantHi ShubhamYou have not provided any PageID and Checksum in store[ ]. Both of them are of 2 bytes each. You could append "0x00,0x01,0x00,0x0f" to your existing store[ ].This might help -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.