Wrox Programmer Forums
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 18th, 2003, 02:58 PM
tps tps is offline
Registered User
 
Join Date: Dec 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default HELP ME

THIS SOFTWARE IN C NOT WORKING MAIL ME AT [email protected]
DEAR THIS SOFTWARE IS FOR PC BASED FREQUENCY MEASURMENT WRITTEN IN TURBO "C" .HELP IT HAS ONLY ONE ERROR

#include
#include
#include
#define MOD 16 /* define counter mod used */
#define LPT 0x379/* LPT1 input port address */
void interrupt(*old_clock)();
void interrupt new_clock();
static int t;
void main()
{ /* tick = Time for which LPT will be read */
float div,mul,tick=54800.0; /* tick is in micro sec. */
double fq,tm,pri;
char data[50000],c;
int count,ls,ps,k,j,N,st;
unsigned i;
old_clock=getvect(0x08);///* capturing time vector */
setvect(0x08,new_clock); /* assigning new time time vector */
do
{ i=0; t=0; clrscr();
gotoxy(25,1); printf("FREQUENCY MEASUREMENT");
gotoxy(23,17); printf("Press any key to pause.....");
while(!kbhit()) /* reading LPT between two time interrupts */
{ /* use "int(LPT)" if using MS product */
while(t2&&t2;k-)
/* analyzing each bit of read data */
{ N=1;
for(j=0;j0&&st<4) count++;
if(st==3)break;/* wave found */
ls=ps;
}
if(st==3) /* calculate frequency of the wave */
{mul=1;for(j=3;jprintf("%d %f %d ",k,mul,count);
tm=((count*div)/mul); fq=1/tm; pri=(100.0/count);
gotoxy(20,7); printf("Frequency = %0.3lf Kilo Hz ", fq*1000);
gotoxy(20,10); printf("Time = %0.3lf micro sec ", tm);
gotoxy(15,23); printf("Precision = %0.5lf percent of main frequency",pri);
gotoxy(15,24); printf("Samples taken in %0.2f ms = %d ", tick/1000,i);
break;
}
if(st<3 && k==3)/* no complete wave was present */
{ gotoxy(24,7); printf("Error in Reading...!");
}
}} t=0; i=0;
}

getch(); gotoxy(13,21);
printf(" Press E Esc for Exit any key other to continue");
c=getch();
}
while (c!=27&&c!='e'&&c!='E');
setvect(0x08,old_clock); /* assigning original time interrupt */
}
void interrupt new_clock() /* new time interrupt service */
{ t++; (*old_clock)();}


TPS PROJECTS









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.