ibrahim03
Full Member level 1
I am trying to interface a mbf200 fingerprint sensor with the ATMEGA32 AVR microcontroller using the parallel bus interface of the microcontroller.
I am having problems with the sensor initialization.
First thing I want to know is that how will i know that the sensor has been initialized correctly ?
I am using the following code for the initialization and from what i have understood is that if the sensor is initialized correctly then the INTR pin should go low on touching the sensor. Is that correct?
Also I dont have any idea about the value of 'Discharge current register' and 'discharge time register' and 'Programmable gain control register' (I am using arbitrary values at present). What are these registers actually used for?
can anyone please guide me?
I am having problems with the sensor initialization.
First thing I want to know is that how will i know that the sensor has been initialized correctly ?
I am using the following code for the initialization and from what i have understood is that if the sensor is initialized correctly then the INTR pin should go low on touching the sensor. Is that correct?
Also I dont have any idea about the value of 'Discharge current register' and 'discharge time register' and 'Programmable gain control register' (I am using arbitrary values at present). What are these registers actually used for?
can anyone please guide me?
Code:
// PORTC connected to data lines of mbf.
// PA0 connected to index data reg selection line(A0)
// PA1 connected to read enable line (active low)
// PA2 connected to write enable line (active low)
//---------------------------
// write into mbf register
//---------------------------
void Write_Reg(unsigned char reg,unsigned char data)
{
DDRC = 0xFF; //portc as output
//select a particular register
PORTA &= ~(1<<PA0);
PORTA |= (1<<PA1);
PORTA &= ~(1<<PA2);
PORTC = reg;
//send data to register
_delay_us( 45 );; //40us delay
PORTA |= (1<<PA0);
PORTC = data;
_delay_us( 45 );; //40us delay
}
//---------------------------
// mbf initialization
//---------------------------
void mbf_initial(void)
{
Write_Reg(0x08,0x00); //reset value of CTRLA reg
Write_Reg(0x0F,0x33); //set threshold value(houzee) (adjust)
Write_Reg(0x09,0x0D); //set value of CTRLB register
_delay_us( 45 );; //40us delay
Write_Reg(0x06,0x40); //discharge time register value(houzee)
Write_Reg(0x07,0x10); //discharge current register value(houzee)
Write_Reg(0x0C,0x08); //gain setting (houzee) (adjust)
Write_Reg(0x0E,0x03); //clear pending work
Write_Reg(0x0D,0x51); //Interrupt control register (*)
_delay_us( 110 );; //100us delay
}