Well not quite but it could :)
The PWM injector driver is working along with
the ignition.
The attached pictures tell the story. The upper power supply
is feeding voltage to the A to D. The number out of the
A to D is controlling the pulse width. In effect
the power supply is simulating a pressure sensor.
The upper trace on the scope is the pulse width.
The lower trace is the CAS coming in twice per
rev at 7500 RPM.
The number out of the A to D is an integer between
zero to 1023. That number must be converted
to a so called "single". A "single" data type
is floating point number between -2,000,000,000
and +2,000,000,000.
Unfortunately the PWM generator requires a floating
point number between zero to 100.
That number is the duty cycle of the pulse width.
It is a percentage of max pulse width. Max pulse
width is then 4 ms. Min pulse width could be .3 ms.
I chose a pulse repetition rate of 250 pulses
per second as that is what it takes to get
a full charge of fuel into the engine in one half
revolution (4 ms) of the e-shaft at 7500 RPM.
A rotor load of fuel.
Plenty of time left over if I do not send data to the pc
with this computer.
Who would have thunk this could be done in BASIC.
Here is the program. It is now time to start adding
features like leaning and panel displays.
We are now sitting in a loop polling pin 12
for the occurrence of rotor1 CAS. This may be changed to
a hardware interrupt if I can decipher the ZBasic docs.
**********************************************************
Sub Main()
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
dim x as long
'check and wait for CAS
'do
for x = 0 to 3000000 'develop only
If (GetPin(12)=1) then
Call rotor1 'go sub rotor 1
end if
if (GetPin(13) = 1) then
Call rotor2
end if
'loop
next x 'develop only
end sub 'main
sub rotor1() 'it is 22 degrees BTDC
Call PutPin(14, zxOutputHigh) 'trigger ign rotor1
dim add1 as integer
dim add2 as single
dim add3 as single
add1 = GetADC(82) 'MAP sensor val must be an integer
Call PutPin(14, zxOutputLow) 'ign trigger off
add2 = CSng(add1) 'convert from integer to long
add3 = add2/10.23 'convert to percentage
'prepare for 250 Hz PWM using channel 3
'pin 26 port B bit 7
Call OpenPWM(3, 250.0, zxFastPWM)
Call PWM(3, add3) ' generate PWM with
Debug.Print " = " & CStr(add3);
'send the PW percentage to the pc gone in final form.
end sub 'rotor1
sub rotor2() 'it is 158 degrees ATDC
'identical to rotor1
End Sub 'rotor2
************************************************
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.