wb_lcd update / new list policy

dcg1174 dcg1174 at tntech.edu
Mon Feb 4 19:04:58 GMT 2002


I have been working on a LCD display for the WB using an Amtel AT90S4433.  It 
has 6 ADC ports, 128 bytes of SRAM, 4k of flash ram in a 0.3" 28 pin dip.  
More importantly, it can be programmed using a LPT port with out a programmer 
using free development software (http://www.dontronics.com/basc-avr.html).  
The free version of the software is limited to 2k program size, but you can do 
alot with 2k. Furthermore, the development software already has built in LCD 
routines, all that's required to output to display is a single command. I 
know, I know... REAL men program in assembly.  But for us amateurs, I think 
this is an excellent way to get into micro-controllers.  Easier even than 
STAMPs i think (certainly cheaper)

I had planned on waiting until I had finished with the first unit to release 
it to the list but this is as good a time as any.  The code I have so far is 
at the bottom of the message...I'm just a lowly ME so be gentle.  I'm using FP 
math (with all the associated penalties) to transform ADC counts to an AFR.  
I've also included a little routine to display a bar graph of symbols 
representing distance from stoich for quick eyeballing.  Obviously, it be 
could set up however one pleased.
I've also included the Print command for output via RS232.  Once it gets to 
the terminal window I'm not sure how to "datalog" (write to a file), but you 
could always cut and paste.  It would also be a simple matter to add RPM to 
the serial output.  It would mean cutting out code somewhere else or buying 
the unrestricted version of the compiler.
 
The current code is almost exactly 2k and I've exhausted my skill trying to 
reduce the size.  Please feel free to make suggestions.

I think its going to work out pretty well. You can build a digital display for 
the DIY_WB for less than $20 and the programming was very easy.  I haven't 
built the hardware yet.  The parts are on the way even though I don't have a 
NTK sensor yet.

I've also included the GNU license statement even though I feel silly doing 
so: the code is very simple.

David

'*****************************************************************************
*
'  Last Updated: February 3, 2002
'  NB:  This code has been tested only with a simulator, NOT with HARDWARE!
'  LCD display code for DIY_WB unit using an Amtel 90S4433  by David C. 
Gregory
'   written for BASCOM-AVR compiler v1.11.6.2
'   Released under GNU GPL liscense: modifications and improvements 
'   must be submitted to diy_efi at diy-efi.org 
'*****************************************************************************
*
       Dim X As Byte
       Dim Afr As Single
       Dim Dispafr As Integer
       Dim Numchars As Byte
       Config Lcd = 16 * 1



   X = 67                                                  'This line for 
simulation
Do
'    X = Getadc(0)
   X = X + 3                                                'This line for 
simulation
   If X <= 128 Then                                         'calculate AFR in 
rich region
    Afr = X * 0.054507                                      'based upon a 2nd 
order
    Afr = Afr - 2.71                                        'polynomial curve 
fit of
    Afr = Afr * X                                           'data included 
with DIY_WB Download
    Afr = Afr + 926
   Else                                                     ' calculate AFR in 
lean region
    Afr = X * 0.5126
    Afr = Afr - 112.3
    Afr = Afr * X
    Afr = Afr + 7460
   End If

   Cls
   Dispafr = Afr
   If Dispafr < 1000 Then Lcd " "
   Lcd Dispafr
   Print Dispafr
   Dispafr = Dispafr / 10

   If Dispafr <= 147 Then
      Numchars = 147 - Dispafr                              'calculate number 
of chars to show
      Numchars = Numchars / 4                               '12  "+" ~ 9.9 AFR
      For X = 1 To Numchars
         Lcd "+"
      Next
   Else                                                     '12 "-" ~ 16.5 AFR
      Numchars = Dispafr - 147
      Numchars = Numchars * 2
      Numchars = Numchars / 30
      For X = 1 To Numchars
         Lcd "-"
      Next
   End If



Loop
End                                                         'end program

----- End of forwarded message from owner-diy_efi at diy-efi.org -----
----------------------------------------------------------------------------
To unsubscribe from diy_efi, send "unsubscribe diy_efi" (without the quotes)
in the body of a message (not the subject) to majordomo at lists.diy-efi.org



More information about the Diy_efi mailing list