Subject: Atmel and ZBasic EFI planing A bit of thinking out loud. second simple EFI program.
From: Rotary Engine
Date: 5/24/2010, 9:29 AM
To: AAA Put this in the To box



 I suggest if you are interested in this system you make
 a folder and drag over all the many future messages on this

This is a second try at a simple EFI program believe it or not..
Not much more than this will be required.

There are two CAS sensors  for rotor one and rotor 2 .

It also sends the injector width value out to a net book.
If you know the width you know the fuel burn.

All this happens at 22 degrees BTDC
at 7500 RPM. At least I think it does. I have to set it
up and test it on the scope with a simulated
CAS pulse coming in at 125 times a second.
No leaning pot or air temp yet. Couple more
A to D's. There may also be a few ZBasic
syntax errors so no guarantees yet.

I added a way of detecting rotor 1 ign fire or rotor
2 ign fire. Each CAS is connected to a different pin.

Unlike early megasquirt this scheme handles ignition.
Not only that with minor changes it could fire
The plugs say every 10 degrees four times
on each rotor. We have plenty of pins to work with.
See the attached jpg. IMHO in theory that will lower
the BSFC. Later... we will get it working first.
***************************************************
Sub Main ()
'first try EFI  program

mainloop:
Call PutPin(12, zxOutputLow) ' pin 12 CAS 1 will be at logic zero
Call PutPin(13, zxOutputLow) ' pin 13 CAS 2 will be at logic zero

Do                 'check and wait for CAS
if GetPin(12) = 1 then goto rotor1
if GetPin(13) = 1 then goto rotor2
loop


rotor1:          'it is 22 degrees BTDC
Call PutPin(78, ZXOutputHigh) 'fire rotor 1 plugs
Call PutPin(78, ZXOutputLow)
goto gettablewidth


rotor2:   'it is 158 degrees ATDC
Call PutPin(79, ZXOutputHigh) 'fire rotor 2 plugs
Call PutPin(79, ZXOutputLow)
'goto gettablewidth

gettablewidth:     'read the map sensor
dim tableadd as  integer 'look up table with 255 values

tableadd = GetADC(82)   'MAP sensor value must be an integer
                         '0 to 254
Dim pi as PersistentInteger
'not sure about this yet
width1 = PersistentPeek(pi.DataAddress)

'the following can be cut down a lot.
Dim width1 as Byte
dim width2 as single
dim width4 as single
dim width5 as single

width2 = CSng(width1)
width4 = width2/254.0 'convert to decimal
width5 = width4 * 100.0   'convert to %

Debug.Print CStr(width5) 'send the pulse width to the net book

Call OpenPWM(3, 125.0, zxFastPWM) ' prepare for 125Hz Fast PWM
Call PWM(3, width5)              ' generate PWM with duty cycle

goto mainloop

End Sub
********************************************************

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.