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 (crank angle sensor)
'do
for x = 0 to 3000000 'develop only
If (GetPin(12)=1) then
Call rotor1
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
add2 = CSng(add1)
add3 = add2/10.23
' prepare for 100Hz Fast PW using channel 2
Call OpenPWM(3, 250.0, zxFastPWM)
Call PWM(3, add3) ' generate PW for injector
Debug.Print " = " & CStr(add3);
Call PutPin(14, zxOutputLow) ' turn off ign trigger
end sub 'rotor1
sub rotor2() 'it is 158 degrees ATDC
'Debug.Print "rotor 2"
End Sub 'rotor2
The Debug.Print value goes out to the PC using the USB port.
Paul Lamar
--
The Rotary Engine NewsLetter. Powered by Linux.
ACRE NL web site.
http://www.rotaryeng.net
Youtube key word PaulLamar2
Copyright 1998-2011 All world wide rights reserved.