Subject: Atmel and ZBasic EFI planing A bit of thinking out loud. First simple EFI program.
From: Rotary Engine
Date: 5/24/2010, 8:35 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 first try at a simple EFI program believe it or not..
Not much more than this will be required.
It sends the MAP value out to a netbook.
There are two CAS sensors this for rotor
one. 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.

***************************************************
Sub Main ()
'first try EFI  program

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

Do While (boolean_expression) 'is true. check and wait for CAS
  GetPin(pin)
Loop

'it is 22 degrees BTDC

Call PutPin(78, ZXOutputHigh) 'fire rotor 1 plugs
'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 255
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 long
dim width4 as long
dim width5 as long

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

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

Call OpenPWM(3, 100.0, zxFastPWM) ' prepare for 100Hz Fast PWM using channel 2
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.