frostbite77
Newbie level 1
Hello,
Can somebody help me in making the write template command work? I have managed to make other functions of this fingerprint module work except for the Write Template function. I'm don't quite understand why the fingerprint module is just returning FFFFFFF...... to my arduino clone board whenever I call the function. Btw, here is reference manual for the fingerprint manual. I bought it from a local electronics store (E-Gizmo): https://docs.google.com/file/d/0BxdLxDCD6HidaEE1djVZTENSR2M/edit
the arduino I am using is an arduino clone which uses an ATmega2560 chip.
This is the code I made for the Write Template Function (I didn't include all the other functions and the setup() and main()):
global variables:
Write Template Function:
Can somebody help me in making the write template command work? I have managed to make other functions of this fingerprint module work except for the Write Template function. I'm don't quite understand why the fingerprint module is just returning FFFFFFF...... to my arduino clone board whenever I call the function. Btw, here is reference manual for the fingerprint manual. I bought it from a local electronics store (E-Gizmo): https://docs.google.com/file/d/0BxdLxDCD6HidaEE1djVZTENSR2M/edit
the arduino I am using is an arduino clone which uses an ATmega2560 chip.
This is the code I made for the Write Template Function (I didn't include all the other functions and the setup() and main()):
global variables:
Code:
byte SData[24] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
int CKS;
byte RData[24] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
byte FPSData[37]; // 34 bytes for command data packet size (6+n+2) CKS = 6+n and 6+n+1
byte FPSReply[39]; //37 bytes for response data packet size
byte TempData[27]; //template data size is 27 bytes
byte TempNum[2]; //template number
Write Template Function:
Code:
void WriteTemplate(){
Serial1.begin(115200);
FPSData[0] = 0x5A;
FPSData[1] = 0xA5;
FPSData[2] = 0x0B;
FPSData[3] = 0x01;
FPSData[4] = 0x1D;
FPSData[5] = 0x00;
FPSData[6] = Get_EmptyID(); // first available template number
FPSData[7] = 0x00;
Serial.println("Copying Template to FPSData:");
for(byte x=8; x<35;x++){
FPSData[x] = TempData[26-(x-8)]; //copy template
Serial.print(FPSData[x], HEX);
}
Serial.println("");
CheckSumLong();
for(byte x=0; x<35;x++){
Serial.print(FPSData[x], HEX);
Serial.print(" ") ;
}
Serial.println("");
Serial1.write(FPSData,37);
delay(2000);
Serial1.write(FPSData,37);
for(byte x=0; x<39; x++)
{
FPSReply[x] = (byte) Serial1.read();
Serial.print(FPSReply[x], HEX);
Serial.print(" ");
}
Serial.println("");
Serial1.end();
}