【Open Source】Fingerprint Recognition Solution Based on T5L Smart Screen

Here introduced an open-source case of DWIN Developer Forum - fingerprint identification solution based on T5L.

The solution is based on Modbus communication through the serial port of the smart screen, realizes accurate control of the fingerprint identification module, and integrates the fingerprint entry and identification functions. It can be used for access control management, employee attendance, intelligent door locks and other scenarios, bringing users a more convenient and secure interaction experience.

【GUI Design】

1569.png

 

C51 Design

Part of the code for the screen to perform Modbus communication is as follows:

 

int main(void)

{   

        INIT_CPU();

        T2_Init();

        UART4_Init();

        EA=1;

//     UART4_SendStr("hello",sizeof("hello"));

        WDT_ON();//Open the Watch dog

        while(1)

        {   

            WDT_RST();//Feed the Dog

            Process();

        }

}

void MainMachineHandle(void)

{

        if(UartDataHandle)

        {

            uartHandle(Uart4_Rx,uart4_rx_count);

            CLR_UartMp3();

            }

}

bool uartHandle(u8 *Tdata,u8 len)

{

        u16Wlen=0;

        u16CRC_1=0,BegAddr=0;

        u8  xdata RetData[Uart4_Rx_Maxlen+10];

        u8  errnum=0;

        CRC_1=CalcCrcAll(0xffff,Tdata,len-2);

        if(CRC_1!= ((Tdata[len-1])<<8 | (Tdata[len-2])))

            returnfalse;

        // This is a write command

        if(Tdata[0]==0&& Tdata[1]!=0x06)

        {

            returnfalse;

        }

        elseif(Tdata[0]!=DevAddr) // device address

        {

            returnfalse;

        }

        // This is a write command

        if(Tdata[1]!=0x03&& Tdata[1]!=0x06 && Tdata[1]!=0x10 )

        {

            SendModbusAckErr(Tdata,1);

            returnfalse;

        }

        Wlen=(Tdata[4]<<8|Tdata[5]);           //Length

        BegAddr=(Tdata[2]<<8|Tdata[3]);       //The start address

        if(Tdata[1]==0x06)// Write to memory

        {

            write_dgusii_vp(BegAddr,&Tdata[4],1);

        }

        elseif(Tdata[1]==0x10)

        {

            write_dgusii_vp(BegAddr,&Tdata[7],Wlen);

        }

        // Read operation response

        //[01][0x03][00][6B][00][02][CRC高][CRC低]

        if(Tdata[1]==0x03)

        {

            RetData[0]=Tdata[0];

            RetData[1]=0x03;

            RetData[2]=Wlen*2;

            read_dgusii_vp(BegAddr,&RetData[3],Wlen);

            CRC_1=CalcCrcAll(0xFFFF,RetData,3+Wlen*2);

            RetData[Wlen*2+3]=CRC_1;

            RetData[Wlen*2+3+1]=CRC_1>>8;

            SendModbusAckOK(RetData,3+Wlen*2+2);

        }

        elseif(Tdata[1]==0x10)

        {

            memcpy(RetData,Tdata,6);

             CRC_1=CalcCrcAll(0xFFFF,(INT8U*)&RetData,6);

            RetData[6]=CRC_1;

            RetData[7]=CRC_1>>8;

            SendModbusAckOK(RetData,8);

        }

        elseif(Tdata[1]==0x06 && Tdata[0]) // Answer when the address code is true

        {

            memcpy(RetData,Tdata,8);

            SendModbusAckOK(RetData,8);         

        }

        returntrue;

}