Back to top

PrintPortTest.C
Links:


Project assistant specialising in mechanical stress, reliability and destructive testing.
Successfully accomplished furniture anti-file resistance testing.


The environmentally controlled work-lab.
Specially designed to provide continuous high levels of electro-static and mechanical stress testing of all parts and tools!


The prototype (well, probably the _actual_ switch.).
No, not the neat plastic looking thingies!
The easi-lift[tm] slip-rotate[tm] mechano-electro toggle switch.
Er, ... yes .. the CD cover with the duct-tape and bits of car radio wired to it.


Project quality officer responsible for management & morale.

Here's the important bit of code so far. Takes port input and debounces count.

printf("About to count up to %d bunches.\n",max);
highlight(10,24,"Press any key to break, if counting stops...");
INITREAD;			/* parrallel port is read */
data=DRDYisHI; olddata=data;    /* This assumes switch closed to start with */
for(count=0;count < max && !kbhit();)
	{
	data=DRDYisHI;
	if (data != olddata)
		{
		start = clock();
		while(data!=olddata && !kbhit()) data=DRDYisHI;
		end = clock(); duration=(end-start)*10/CLK_TCK;
		if (duration > BUNCH_THRESH)
			{
			count++;
			printf("%ld %ld %d\n",start,end,count);
			}
		else printf("boing ");
		}
	}
printf("\n\n%d bunches counted.",count);
PressKey();