anyone can plz explain the code below....i have understood the basics of outortb and inportb but couldnt understand why and where specific hexcode values are used
#include<stdio. h> //header//
#include<conio. h> //header//
#include<dos.h> //header//
#include<graphi cs.h> //header//
#include<proces s.h> //header//
#include<time.h > //header//
#define PORT1 0x3f8 //port address//
unsigned char ca_data[25];
void portinit(void)
{
outportb(PORT1 + 1,0);
outportb(PORT1 + 3,0x80);
outportb(PORT1 + 0,0x0c);
outportb(PORT1 + 3,0x03);
outportb(PORT1 + 4,0x0B);
}
char* dwt(){
time_t t;
time(&t);
return ctime(&t);
}
void portclr(void)
{
char ch;
while(inportb(P ORT1 + 5) & 1)
{
ch=inportb(PORT 1);
}
}
void portread(int dnum,int timout)
{
int i=0,j=0;
while((i < timout) && (j < dnum))
{
delay(1);
if((inportb(POR T1 + 5) & 1))
{
if(j!=0)
{
ca_data[j]=inportb(PORT1) ;
j++;
}
else
{
ca_data[j]=inportb(PORT1) ;
if(ca_data[j]==0x65) //0x55
j++;
}
}
i++;
}
ca_data[dnum]=j;
}
void main(void)
{
int scan=0,device_1 =0,device_2=0,d num=12,timout=1 000;
clrscr();
printf("A Project on RFID System\n");
do
{
do
{
portinit();
do
{
portclr();
do
{
//printf("Scannin g...........\n" );
portread(dnum,t imout);
}
while(ca_data[dnum] < dnum);
}while((ca_data[0]!=0x65)||(ca_da ta[1]!=0x99));
printf("\nA Project on RFID System");
printf("\nScann ing............ ............... .....");
if(ca_data[3]==0x56)
device_1=1;
if(ca_data[3]==0x59)
device_2=1;
scan++;
}while(scan<5);
clrscr();
printf("A Project on RFID System\n");
printf("\nScann ing Results........ ...");
printf("\nAvail able Devices........ ..");
if(device_1==1)
printf("\nDevic e Name________Ele ctronic Notebook");
if(device_2==1)
printf("\nDevic e Name________Vac uum Cleaner");
printf("\nprese nt time________%s" ,dwt());
if((device_1==0 )||(device_2==0 ))
{
printf("\n\nDev ices Missing........ ..");
if(device_1==0)
printf("\nDevic e Name________Ele ctronic Notebook");
if(device_2==0)
printf("\nDevic e Name________Vac uum Cleaner");
sound(3000);
printf("\nprese nt time________%s" ,dwt());
printf("\nPress any key to Continue....... ..");
getch();
}
printf("\n\n\n_ _______________ _______________ ___");
device_1=0;
device_2=0;
scan=0;
//delay(1000);
}while(!kbhit() );
}
insight on below specific lines would be highly appreciated :
}while((ca_data[0]!=0x65)||(ca_da ta[1]!=0x99));
if(ca_data[j]==0x65) //0x55
#include<stdio. h> //header//
#include<conio. h> //header//
#include<dos.h> //header//
#include<graphi cs.h> //header//
#include<proces s.h> //header//
#include<time.h > //header//
#define PORT1 0x3f8 //port address//
unsigned char ca_data[25];
void portinit(void)
{
outportb(PORT1 + 1,0);
outportb(PORT1 + 3,0x80);
outportb(PORT1 + 0,0x0c);
outportb(PORT1 + 3,0x03);
outportb(PORT1 + 4,0x0B);
}
char* dwt(){
time_t t;
time(&t);
return ctime(&t);
}
void portclr(void)
{
char ch;
while(inportb(P ORT1 + 5) & 1)
{
ch=inportb(PORT 1);
}
}
void portread(int dnum,int timout)
{
int i=0,j=0;
while((i < timout) && (j < dnum))
{
delay(1);
if((inportb(POR T1 + 5) & 1))
{
if(j!=0)
{
ca_data[j]=inportb(PORT1) ;
j++;
}
else
{
ca_data[j]=inportb(PORT1) ;
if(ca_data[j]==0x65) //0x55
j++;
}
}
i++;
}
ca_data[dnum]=j;
}
void main(void)
{
int scan=0,device_1 =0,device_2=0,d num=12,timout=1 000;
clrscr();
printf("A Project on RFID System\n");
do
{
do
{
portinit();
do
{
portclr();
do
{
//printf("Scannin g...........\n" );
portread(dnum,t imout);
}
while(ca_data[dnum] < dnum);
}while((ca_data[0]!=0x65)||(ca_da ta[1]!=0x99));
printf("\nA Project on RFID System");
printf("\nScann ing............ ............... .....");
if(ca_data[3]==0x56)
device_1=1;
if(ca_data[3]==0x59)
device_2=1;
scan++;
}while(scan<5);
clrscr();
printf("A Project on RFID System\n");
printf("\nScann ing Results........ ...");
printf("\nAvail able Devices........ ..");
if(device_1==1)
printf("\nDevic e Name________Ele ctronic Notebook");
if(device_2==1)
printf("\nDevic e Name________Vac uum Cleaner");
printf("\nprese nt time________%s" ,dwt());
if((device_1==0 )||(device_2==0 ))
{
printf("\n\nDev ices Missing........ ..");
if(device_1==0)
printf("\nDevic e Name________Ele ctronic Notebook");
if(device_2==0)
printf("\nDevic e Name________Vac uum Cleaner");
sound(3000);
printf("\nprese nt time________%s" ,dwt());
printf("\nPress any key to Continue....... ..");
getch();
}
printf("\n\n\n_ _______________ _______________ ___");
device_1=0;
device_2=0;
scan=0;
//delay(1000);
}while(!kbhit() );
}
insight on below specific lines would be highly appreciated :
}while((ca_data[0]!=0x65)||(ca_da ta[1]!=0x99));
if(ca_data[j]==0x65) //0x55
Comment