Subject: AVR assemble language
From: Rotary Engine
Date: 11/25/2011, 6:07 PM
To: AAA Put this in the To box


 I have about decided to do a single chip solution to
 the dwell ignition problem because potentially it is the
 cheapest way to do a stand alone ignition for use with a carb.
 The knowledge gained can then be used to do a variety of simple
 things including a trim table adjustment to the 555 fuel injection
 system using spread sheet data as suggested by Henry Nee.

 I will focus on assembly language as these are time critical jobs
 and with assembly language you always know how long
 it takes to do anything. If you keep the job short and
 simple the software size will be manageable from many aspects.

 Further more I have considerable experience with assembly
 language much of which can be applied to the AVR instruction
 set.

 I realize that most of you will not be interested so you
 can delete the messages on the subject.

 Those that wish to follow along can make a folder and move
 the stuff over to that.

 Tom Walter, I think, was the first to mention the
 Arduino board as a good low cost and small AVR trainer that will
 do a variety of jobs. The advantage is it is wired
 for USB and there is programming software that runs
 on both Windows and Linux.

 There are a lot of people using this board around the world so there
 should eventually be a lot of asm code examples.

 The Arduino Mega 2560 is a small microcontroller board based on
 the ATmega2560. It has 54 digital input/output pins (of which 14
 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware
 serial ports), a 16 MHz crystal oscillator, a USB connection, a
 power jack, an ICSP header, and a reset button. It contains
 everything needed to support the microcontroller; simply connect
 it to a computer with a USB cable.

 We will be using only a very few of these capabilities but the
 cost and size is so low it does not matter.

 AVRA is an assembler for Atmel AVR microcontrollers, and it is almost
 compatible with Atmel's own assembler AVRASM32.

 The initial version of AVRA was written by John Anders Haugum in
 1999. He released all versions until v0.7. All later versions were
 released by Tobias Weber. And version 1.3.0 is released by Jerry
 Jacobs.

 Paul Lamar

 Runs on a Mac too. This is the board we are using in the
 Mechatronics
 courses at the University of Utah. Mostly for automated robots
 with lots of sensors.

 Chris Cosman

 Paul,

 The AT90USB Demo-Kit sells for 31.00 on Digikey and I think
 provides similar resources, plus has some external flash storage
 that might help for storing tables. Check it out, as it could be a
 cheaper alternative.

 Thanks,
 Brannon

 That is a bargain. I had to call and confirm it was completely
 assembled.
 That beats the Arduino for our purposes. Thanks for finding that
 Brannon.
 I ordered one.

 Paul Lamar

 Paul,

 No problem, happy to help. Let me know if you would like any help
 coding
 this up or if you'd like someone to review your code. I've done several
 designs on these processors and one on this board in particular.

 One note, you might want to consider writing the majority in C, as
 you will be able to use the Atmel supplied libraries for USB
 communication, etc, and coding your time critical procedures in
 assembly. Most compilers have statements that allow you to write in-
 line assembly. Also, you can always generate the .lst file on
 compile and see what assembly is being generated for any code you do
 write in C.

 Thanks,
 Brannon

 Great Brannon!

 Good to hear it. Here is the problem.
 At 7500 RPM the engine makes one rev in 8 ms.

 The RX8 coil delays a fixed 2 ms after the crank sensor tells
 it to fire. This is called dwell. In effect what this does is retard
 or reduce the advance near 90 degrees. That causes the spark to fire
 about 70 degrees AFTDC!!!!!! Of course losing power in the bargain
 and hurting the BSFC. (fuel burn).

 My suggestion is to measure the period of a given RPM and anticipate
 the advance required up to 2 ms at 7500 RPM for the next revolution.
 As you go through the rev range of course the adjustment changes. No
 adjustment at idle and a lot
 (2ms) at 7500 RPM.

 Any ideas? Do you have a scope you can test it with?

 CD's don't do this but they are a lot of bucks compared
 to the LS1 or RX8 coils with built in solid state switches.

 Paul Lamar


 Automotive computer ignitions use the previous CAS signal to fire the
 plug
 you want. It is easy to delay the firing event, but anticipate it?
 What could
 be used is the adjustable pick-up mounting and a timing light to find
 where it
 needs the pick-ups to be to get the advance required. Once the
 position is
 determined for the set-up, the rest should be close with a small
 adjustment
 like setting timing on the distributor.

 Dale Davies

 Well if you measure the time it took to rev the engine once
 and subtracted 2 ms when you fired on the next rev I think that would
 work.


 Paul Lamar


 For a 2-rotor, measure the time for half a rev by timing from rotor1 CAS
 to rotor 2 CAS, then subtract the 2 ms.

 For CDI you can get motor scooter ignition packs for under $10. Use two
 in parallel and deliver 40 millijoules to the coil. 4 wires to each pack
 - 12 volts, ground, output to coil, and trigger. They are made to work
 with inductive CAS sensors.

 http://www.scooterpartssale.com/index.php?main_page=product_info&cPath=71_77&products_id=191



 Victor Roberts

 That might work for a 2 rotor. Our immediate need is for a one rotor.

 Paul Lamar

Why not set the physical timing so that the plug fires at the desired
advance by default at 7500 RPM and then use the software to delay the
firing at lesser RPMs.  Anticipating the event is a bit harder to code
than reacting to the event after it occurs.  The computer will be
calculating a timing retardation instead of a timing advance.

 Mark LaPierre

I got the $30 AVR Explaine test board. Lots of I/O to test a program.
Switches for inputs. LED and a speaker for out put.
Probably more powerful than an IBM mainframe from just a few
years ago.

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.