Subject: Atmel and ZBasic EFI planing A bit of thinking out loud.
From: Rotary Engine
Date: 5/24/2010, 2:43 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
      subject or otherwise delete it.

Here are the ZBasic Library Reference Index in both doc
and pdf form as promised. A good idea is print this out
for rapid access when programming. I can't remember
how everything works so I have to look things up from
time to time.

The vast number of routines is what makes this such a powerful
real time controller BASIC language.

Paul Lamar

Did you intend to attach something here?
Ed Carver

Your right Ed. Sorry. Here they are.

-------------------------------------------------

When planing it also helps to see how other EFI systems work.
One of the very few that are open for perusal is the Megasquirt.
Here is a flow chart for the Megasquirt. Note that triggering
the ignition is not part of the program unfortunately.
There are some things in here that an aircraft system
probably does not need such as enrichment for rapid
engine acceleration. Also missing is a facility for
leaning.

It would be a big help in understanding and tuning Tracy's
system if we had such a chart.

---------------------------------------------------

Here is just a bit of the PWM asm code from the Megasquirt web site.


***************************************************************************
DOSQUIRT:
      lda      igncount
      bne      EGOBUMP   ; Only increment ase counter if cylinder count is zero
         inc       asecount       ; Increment after-start enrichment counter
EGOBUMP:
         inc       egocount       ; Increment EGO step counter
         lda       rpmch
         sta       rpmph
         lda       rpmcl
         sta       rpmpl
         clr       rpmch
         clr       rpmcl
             lda     rpm
      sta      old_rpm1      ; Used in odd-fire code - save the last computed RPM
for average
         bset      fuelp,porta    ; Turn on fuel Pump
         bset      running,engine ; Set engine running value
         brset     crank,engine,SCHED_SQUIRT      ;Squirt on every pulse if cranking
         inc       igncount       ; Check to see if we are to squirt or skip
         lda       igncount
         cmp       divider
         beq       SCHED_SQUIRT
         lda       igncount
         cmp       #$0F        ; The maximum allowed - reset if match
         bne       IRQ_EXIT
         clr       igncount
         bra       IRQ_EXIT
SCHED_SQUIRT:
         bset      fuelp,porta    ; Turn on fuel Pump
         bset      running,engine ; Set engine running value
         clr       igncount
         brset     crank,engine,SCHED_BOTH
         lda       alternate
         beq       SCHED_BOTH
         inc       altcount
         brset     0,altcount,SCHED_INJ2
SCHED_INJ1:
         lda       pwcalc
         sta       pw              ; latched calculated pulsewidth
         clr       pwrun1          ; Running counter variable set to zero
         bset      sched1,squirt
         bset      inj1,squirt
         bra       IRQ_EXIT
SCHED_INJ2:
         lda       pwcalc
*******************************************************************************

The rest of the PWM  asm code required is scattered through out the program.
It took me a year full time to learn and write my first 6502/6800 asm program.

Microprocessor-Based System for Roll-Down and Acceleration Tests
by D.K. Lynn, C.R. Derouin, and Paul Lamar
Los Alamos Scientific Laboratory
Published in IEEE Proceedings 29th Vehicular Technology Conference
(The technical details of the road test system.)
Arlington, Illinois, March 28-30, 1979


Later Megasquirt code was written in C and that is when they lost
me. I have no idea how long it would take to learn C.

Here is how easy it is to do PWM in ZBasic.

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.