EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / #include#include

#include#include

|

Microcontroller › 8051 › Communication between r303 with 8051 › #include#include

April 18, 2014 at 4:15 pm #11589
Drona
Participant

#include<reg51.h>
#include<string.h>

unsigned char Ack[28];
unsigned char TemplateNum[2];//It is Two Bytes of data
unsigned char statReg,sysIDcode,FingLibSize,securityLvl,DeviceAddr[2],DataPckSize,baudRate;
void rx(unsigned int num)
{
 i=0;
 while(RI && i<num)
 {
  Ack[i++]=SBUF;
  RI=0;
 }
 Ack=’’;
}
void tx1(unsigned char y)
{
  SBUF=y;
  while(TI==0);
  TI=0;
}
void delay(unsigned int x)
{
  unsigned int i,j;
  for(i=0;i<x;i++)
  for(j=0;j<1000;j++);
}

void scan_fin()
{
 unsigned char i,j;
 unsigned char VryPwd[]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x07,0x13,0xFF,0xFF,0xFF,0xFF,0x04,0x17};
 unsigned char ReadSysPara[]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x03,0x0F,0x00,0x13};
 unsigned char ReadTemplateNum[]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x03,0x1D,0x00,0x21};
 unsigned char GenImg[]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x03,0x01,0x00,0x05};
 unsigned char Img2T[]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x04,0x02,0x01,0x08};
 unsigned char search[17]={0xEF,0x01,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x08,0x04};
 
 unsigned char MatchScore[2],pageID[2];
 
 //This is to verify the password of Bio-Metric
 do
 {
  for(i=0;k<strlen(VryPwd);i++)
   tx1(VryPwd);
  delay(1000);
  rx(16);
 }while(Ack[9]!=0x00);
 //This is to retice the system parameters of Bio-Metric
 do
 {
  for(i=0;i<strlen(ReadSysPara);i++)
   tx1(ReadSysPara
);
  delay(1000);
  rx(28);
 }while(Ack[9]!=0x00);
 statReg=Ack[10];
 sysIDcode=Ack[11];
 FingLibSize=Ack[12];
 securityLvl=Ack[13];
 DeviceAddr[0]=Ack[14];
 DeviceAddr[1]=Ack[15];
 DataPckSize=Ack[16];
 baudRate=Ack[17];
 //This is to retrive the Template Number from Bio-Metric
 do
 {
  for (int i = 0; i < strlen(Syspara); ++i)
   tx1(ReadTemplateNum);
  delay(1000);
  rx1(14);
 }while(Ack[9]!=0x00);
 TemplateNum[0]=Ack[10];
 TemplateNum[1]=Ack[11];
 //This is to Scan Finger and Place it in imageBuffer
 do
 {
  for (int i = 0; i < strlen(GenImg); ++i)
   tx1(GenImg
);
  delay(1500);
  rx1(12);
 }while(Ack[9]!=0x00);
 //This is to Convert the Image in ImageBuffer to charBuffer
 do
 {
  for (int i = 0; i < strlen(Img2Tz); ++i)
   tx1(Img2Tz
);
  delay(1000);
  rx(12);
 }while(Ack[9]!=0x00);
 //This is to compare the CharBuffer and The Values stored
 search[10]=0x01;     //This is for BufferID
 search[11]=0x00;     //This is for StartPage Byte 1
 search[12]=0x00;     //This is for StartPage Byte 2
 search[13]=TemplateNum[0];   //This is for Pagenumber byte 1
 search[14]=TemplateNum[1];   //This is for PageNumber byte 2
 

 //This below Two Bytes are for Check Sum
 search[15]=
 search[16]=
 

 

 do
 {
  for (int i = 0; i < strlen(search); ++i)
   tx1(search);
  delay(1000);
  rx(16);
 } while (Ack[9]!=0x00);
 pageID[0]=Ack[10];
 pageID[1]=Ack[11];
 MatchScore[0]=Ack[12];
 MatchScore[1]=Ack[13];
//Note is Page ID Same as Template ID
} 
void main()
{
 void scan_fin();
}

 

any one tell me how to calculate 2 byte check sum of hexa value….

 

Is there any fault in this program….
i am not getting the output…. Except the check sum part…
 

RSS Recent Posts

  • Getting into an LED bulb April 21, 2026
  • understanding of resonance in time domain April 21, 2026
  • Beginner Questions About CNC Machines – G-code, Control Systems & Accuracy April 21, 2026
  • A Must-Watch Video Showing Dangerous Construction of Cheap Lithium-Ion Cells April 21, 2026
  • S1MJ ? April 20, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise