Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
Genraly U can Mesure time interval by Parallel Port But the smallest measurable Unit will depend on Speed of PC and U will Use all Resource of PC just for time mesurement.
To do that (mesure time by PC w\o external timer) frist CONVERT the time interval to electrical signal +5V and 0V say U express the begineng of time interval by fall edge and end by rise edge.
second input this signal on any data pin of LPT and scan falling edge then start count up tp detect falling edg.
But U'r PC can not do any other thing During Mesurment.
U can use external timer or Interrupt of ISA Bus to do this.
you should prepared dos based program for this
you should boot your computer in dos and launch that program
this reduces the error in measurement
here is code
/* Project To mesure the velocity of the moving vehicle */
/* Uses two status port of parallel pin no. 10 and 11 */
/* For pinouts Reference http://www.ctips.com/spp.html */
/* Base address for parallel port is 0x378 in hex */
/* Base address for parallel input port is 0x379 in hex */
/* conio.h is needed for the clrscr() and gotoxy() */
/* dos.h is needed for the inportb() and delay()*/
#define PORT 0x379 /* Assign the address of parallel port to PORT */
#define MAX_COUNT 3000
/* Defines the count variable to store the counted time interval */
unsigned long count;
/* Defines the variable for the sensor data and the input port address */
int SENSOR_1, SENSOR_2, data;
/* Assigns the input port address to variable data */
/* Assigns the Status of the sensor -1 to variable SENSOR_1 */
SENSOR_1=(data & 0x80)/0x80;
/* data&0x80 masks the binary value availabe in data with 0x80 and division by 0x80 returns the status of the Pin 11 */
/* Assigns the Status of the sensor -2 to variable SENSOR_2 */
SENSOR_2=(data & 0x40)/0x40;
while(!kbhit()) /* loop continues until any key is pressed */
while (!(SENSOR_1&SENSOR_2)) /* Scans whether both port data is one or not */
while (SENSOR_1) /* checks whether sensor-1 data changed to zero or not */
for(count=0; ;count++) /* Counts the time interval with 1ms Precision */
if(SENSOR_2!=1&&count==MAX_COUNT) /* Checks whether sensor-2 data has changed to zero or not and stops count porcess */