[Diy_efi] Newby, Possible PC control?

Shaun Wilson (FDN) elywilson at furtherdown.net
Mon Jun 24 19:47:58 GMT 2002


I'm a developer of about 12 years, 6 professionally and 4 exclusively
under a windows environment.

With an IO card, and your electrical background, I'm assuming you could
build a controller card that could be interfaced with from windows. From
this perspective the latency 'felt' in windows wouldn't be a problem.

But let's pretend this isn't what you meant, instead you're maybe
suggesting
A pci card that provides leads/pins to your other modules and
interfacing with those modules would be done directly through IO ports
etc.  In this case you might run into problems.  You will need a top-end
system, no less than a P3 1.2ghz or P4 1.8ghz, I wouldn't trust my life
in the hands of a sub-premium system. On top of this you will want a
heavily stripped OS.  No extra services (indexing, office, language bar
etc), you will want to use windows 2000 for both stability and timing,
on your average p4 you can get a resolution of several thousand 'ticks'
per second.  You can do the math and derive HZ from this.  This tick
count will be specific to the config of your system.  There is a windows
api call to get this frequency, and another call to get the current
counter status.  On my home machine I get a tick frequency of 3579545
ticks per second.  Whatever application is written will have to have
'realtime priority' set on the main thread so that your application has
the maximum execution time allowable, reducing the latency caused by
thread manager timeslicing (windows is a multithreaded os, and each
thread executes one at a time for an arbitrary amount of time, setting
realtime for a thread is like giving a thread the ability to grind your
system to a halt all in the name of top performance for a single
operation).

Consider that the ecu on many systems is an intel i8091/i8096 (correct
me if I'm wrong) and these run at a clock of about 12mhz (again correct
me if I'm wrong), so speed/response wouldn't be my concern.. the latency
would, I think it can be done, but I'm a geek and I lack more
fundamental knowledge about engines etc.  

Referring back to that 'timer granularity' above I have some example
code (in C#), these results here are from a P4 2.2Ghz:

----
 Counts Per Second (Frequency): 3579545
         Estimated Granularity: 17
                  Estimated HZ: 210561
----

'granularity' is variable, and that's where your problem lies. Like I
was saying before I lack mechanical knowledge about car engines and
their electronics, so I don't know that maybe a 20tick 'drift' is
allowable (to be safe, the average drift on this is about 3-5 ticks and
I have about 14 apps running).

Here are some sequential results to show drift:

----
                     Frequency: 3579545
         Estimated Granularity: 17
         Estimated Granularity: 17
         Estimated Granularity: 15
         Estimated Granularity: 15
         Estimated Granularity: 15
         Estimated Granularity: 15
         Estimated Granularity: 16
         Estimated Granularity: 15
         Estimated Granularity: 16
         Estimated Granularity: 16
         Estimated Granularity: 16
         Estimated Granularity: 15
         Estimated Granularity: 17
         Estimated Granularity: 15
         Estimated Granularity: 17
         Estimated Granularity: 15
         Estimated Granularity: 16
         Estimated Granularity: 16
         Estimated Granularity: 15
         Estimated Granularity: 16
                  Estimated HZ: 223721
----

This still doesn't present latency on hardware IO, which is something I
have no ready means of timing.

Personally I think you'd be safer with a firmware system. The power
requirements of a PC seem like a bit much, you should probably go with a
laptop for both hardware stability (drives, wiring) since they are
designed for shock/turbulence etc.  I can't think of anything worse than
you hitting a bump and having your box lock up because of a HD failure
that windows decided to hiccup on :( 

Hope that helps.

---- begin snippet (code used for above timings)
using System;
using System.Runtime.InteropServices;

namespace QueryPerfCounter
{
	/// <summary>
	/// 
	/// This is an example of calling the system High-Resolution
Counter, useful when you need
	/// timings of a higher precision than other system time
functions provide.
	/// 
	/// Shaun Wilson mailto:mnet at furtherdown.net
	/// Submitted to http://www.GotDotNet.com/ May 2002
	/// 
	/// </summary>
	class QueryPerfCounter
	{
		[DllImport("kernel32.dll")]
		private static extern uint QueryPerformanceFrequency(ref
long Frequency);
		[DllImport("kernel32.dll")]
		private static extern uint QueryPerformanceCounter(ref
long Count);
		
		[STAThread]
		static void Main(string[] args)
		{
			long Frequency = 0;
			long OldCounts = 0, NewCounts = 0;
			QueryPerformanceFrequency(ref Frequency);
			QueryPerformanceCounter(ref OldCounts);
			QueryPerformanceCounter(ref NewCounts);
			Console.WriteLine("
Frequency: {0}", Frequency);
			int x = 0;
			for (x=0; x<20; x++)
			{
				QueryPerformanceCounter(ref OldCounts);
				QueryPerformanceCounter(ref NewCounts);
				Console.WriteLine("         Estimated
Granularity: {0:g}", ((double)(NewCounts-OldCounts)));
			}
			Console.WriteLine("                  Estimated
HZ: {0:g}", ((double)(Frequency/(NewCounts-OldCounts))));

		}
	}
}
---- end snippet

-----Original Message-----
From: diy_efi-admin at diy-efi.org [mailto:diy_efi-admin at diy-efi.org] On
Behalf Of BigBlock
Sent: Saturday, June 22, 2002 9:15 PM
To: diy_efi at diy-efi.org
Subject: [Diy_efi] Newby, Possible PC control?

I have years of experience in engine building, almost none in FI
systems.  I
am an engineer with a fairly strong electrical background.  I am very
interested in constructing a FI system for my 86 K5 blazer.  This is an
interest as a hobby (I know I could goto the junk yard and purchase a
TBI
setup if I was simply tired of the carb)  Is it possible to run a
windows
based PC with an I/O card as the microprocessor? Or would windows cause
too
much timing interference?

Andy





_______________________________________________
Diy_efi mailing list
Diy_efi at diy-efi.org
http://www.diy-efi.org/mailman/listinfo/diy_efi



_______________________________________________
Diy_efi mailing list
Diy_efi at diy-efi.org
http://www.diy-efi.org/mailman/listinfo/diy_efi



More information about the Diy_efi mailing list