There is real time and then there is REAL TIME.
Controlling the fuel injection and the ignition
timing on a multi rotor or  multi cylinder engine requires
absolute control down to the nearest micro second.
One millionth of a second. You must know exactly
how long it takes to complete any instruction.
One of the strengths of ZBASIC and other BASICs is; it can
deal simply with floating point numbers (and other types
of numbers) in the range  of +/- 2 million.
Unfortunately an 8 bit computer needs four or more
memory locations to store numbers that large. Maybe
more. The computer must read those memory locations
one by one in the proper sequence.
If the computer receives a hardware interrupt
and is forced to go out and immediately do something else
while it is the process of reading the memory locations the
number could be garbled.
Now this could be just ZBasic. It could be a function
of the compiler. I am not sure but BASIC's running on
powerful computers with over 80 I/O pins are few and far
between so I am sticking with the Atmel and ZBasic.
So I decided to do the time critical stuff in hardware
such as trigger the ignition and determine the RPM Â and
not worry about it.
Paul Lamar
Paul,
This is what a floating point processor / coprocessor does
for you; makes 'float' operations atomic. What you're seeing
is the compiler simulating floating point ops using integer
registers. You should try to stick with 'int' as much as possible.
I've been working on hanging the rad, oil cooler, relocated
oil filter, etc. Also been working on the exhaust manifold.
I purchased the RX8 exhaust flange from Mazdatrix, and was
disappointed to discover machining was required to correct
the alignment with the exhaust ports. I purchased some 321
0.060 stainless elbows and am experimenting with routing
configurations.
--Kenny A.
The Atmel does not have a math co processor.
The term "atomic" is interesting. It confuses the
heck out of me :)
"In ancient philosophy, an atom was the ultimate unit
of matter on which more complex views of material reality
were based. In computer programming, atomic describes a
unitary action or object that is essentially indivisible,
unchangeable, whole, and irreducible."
What does it mean in Dick and Jane language? :)
Me too on that RX8 exhaust flange. Lots of die grinding
required.
Paul Lamar
Anything that is considered ATOMIC happens without interruption.
Some instructions are complex and take many clock cycles. If the
instruction is atomic then it will not be interrupted before it is
finished.
--
Blake C. Lewis
Thanks Blake that is very clear. Now I understand.
Let me paraphrase from a single board assembly language
point of view when speaking about a high level language.
"If the instruction is atomic then it [MUST] not be interrupted
before it is finished."
That in a nut shell is the major problem with real time
hardware interrupts and high level languages.
In the real hardware world interrupts can come in at any
time such as the CAS signal and they must be dealt in the shortest
possible time.
They are handled by the asm programmer
by stopping the so called atomic HL instruction, saving all the
variables having to do with that HL instruction on a device called
a first in last out stack (I'll explain later) and executing what
needs to be done right now for that hardware interrupt like
firing the plugs lickity split.
It then restores all the variables and goes back to the point
in time where the "atomic" HL instruction was executing and
allows it to start executing again. I suspect the guy that wrote
ZBasic did not fully understand this or choose to disable
hard ware interrupts while certain HL atomic routines were executing.
The "certain" HL routines involved had to do with what he felt
were time critical tasks. On the other hand using assemble language
the programmer must deal with the time it takes to execute any and
all instructions or routines in excruciating detail. Nothing is
really considered atomic.
As you can see this is a real can of worms.
What I choose to do was not use ZBasic for time critical hardware
interrupts like firing the plugs on time and determining
the RPM. I am designing a few hardware modules that will
interface with ZBasic and use what ZBasic is good at. Namely
making decisions and doing the math. The Atmel ZBasic 1280
pc board is ideal for this approach as it has over 80
I/O bits to connect to the outside world. I will
use 16 of those bits just for determining the RPM.
I also changed the the whole philosophy of the
traditional EFI system by choosing not to inject
fuel at specific times. Once this choice is made
this frees the computer for having to do everything
in 4 milliseconds at 7500 RPM. Our engines runs so fast
most of the time it probably does not care and can not
tell when the fuel is injected. Most aircraft fuel
injection systems work this way.
You cannot say this about a car engine idling or
going down the freeway at under 2000 RPM. The
computer has a lot more time to do everything
in a given time period.
The big pay off is the pilot will receive a wealth
of engine information on a large screen in what
he perceives as real time. Faster than his eyes can
perceive the changes. It will be slowed down
so he can read it. All engine information such as
EGT, injector pulse width, fuel burn rate, total
fuel burned, manifold pressure, RPM, engine water
temperature, oil temperature and etc., etc., is also
recorded every second. A black box for GA. That capability
is a built in feature of ZBasic and most Basics for
that matter. A $200 net book does that job. Solid state
40 gig flash memory if you choose an EeePC. In effect
we are using multiple processors.
That was also a feature of my moving map program, written
in QB, back in 1990 running on a DOS PC. No it won't
run under Windows :) I can send you the source code
however. The data was stored on a floppy drive.
You implement this EFI and a recording EFIS is thrown in
for free. The same EFI hardware does both things.
Paul Lamar
--
The Rotary Engine NewsLetter. Powered by Linux.
ACRE NL web site.
http://www.rotaryeng.net
Youtube key word PaulLamar2
Copyright 1998-2010 All world wide rights reserved.