arunbharathi.arasu
Full Member level 2
- Joined
- Feb 28, 2013
- Messages
- 134
- Helped
- 7
- Reputation
- 14
- Reaction score
- 6
- Trophy points
- 1,298
- Location
- Chennai, Tamil Nadu, India
- Activity points
- 2,151
Dear Friends,
I'm using R305 Fingerprint sensor for my project.
I don't know how to get data from fingerprint sensor.
I wrote simple code for R305, which is given below.
I used Hi-Tech C compiler.
I'm using R305 Fingerprint sensor for my project.
I don't know how to get data from fingerprint sensor.
I wrote simple code for R305, which is given below.
I used Hi-Tech C compiler.
Code:
#include<htc.h>
#include<stdio.h>
#include <string.h>
#include"uart.h"
#include"gsm.h"
unsigned char Arraydata[160],count=0;
void port_init()
{
TRISD1=0; // IGNITION CNAGE TO OFF/ON
TRISD2=1; // IGNITION STATUS CHECK
TRISD3=1; // AC STATUS CHECK
}
void delay(unsigned int de)
{
unsigned int maxde,minde;
for(maxde=0;maxde<de;maxde++)
for(minde=0;minde<453;minde++);
}
void interrupt uart_ISR(void)
{
if(RCIF == 1)
{
IG_CHANGE=1;
Rx_data=RCREG;
RCIF=0;
if(Rx_data!= '\r')
{
Arraydata[count]= Rx_data;
count++;
}
else
{
Arraydata[count]='\0';
}
trans_string(Arraydata);
}
}
void port1_init()
{
TRISC6=0;
TRISC7=1;
}
void transmitter_data(unsigned char dat)
{
while(!TRMT);
TXREG=dat;
}
void trans_string(unsigned char *str)
{
while(*str!='\0')
{
transmitter_data(*str);
str++;
delay(20);
}
}
void UART_init()
{
TXEN = 1; // transmission side enable
SYNC = 0; // enable asynchronous bit
BRGH = 1; // enable high baud rate generator
TRMT = 0; // make transmit shift register are full
TX9D = 0; // disable 9bit transmission
SPEN = 1; // enable serial port in receiver side
CREN = 1; // enable continuous reception
ADDEN = 0; // disable address decets bit
FERR = 0; // set no framing error bit
OERR = 0; // set no overrun bit
RX9D = 0; // disble 9bit reception
SPBRG = 129;// load SPBRG value for 9600 baud rate for 20 mhz
GIE = 1;
IPEN = 1;
GIEH = 1;
GIEL = 1;
PEIE = 1;
RCIE = 1;
RCIP = 1;
}
void main()
{
port_init();
port1_init();
UART_init();
while(1)
{
trans_string("0xEF\r");
delay(100);
trans_string("0x01\r");
delay(100);
trans_string("0xFF\r");
delay(100);
trans_string("0xFF\r");
delay(100);
trans_string("0xFF\r");
delay(100);
trans_string("0xFF\r");
delay(100);
trans_string("0xFF\r");
delay(100);
trans_string("0x01\r");
delay(100);
trans_string("0x00\r");
delay(100);
trans_string("0x03\r");
delay(100);
trans_string("0x01\r");
delay(100);
trans_string("0x00\r");
delay(100);
trans_string("0x05\r");
delay(10000);
}
}
Last edited by a moderator: