Yahoo!
Groups Home - Yahoo! - Help



Welcome, roddonau (roddonau · simmstick_moderator@dontronics.com) Start a Group - My Groups - Account Info - Sign Out  
simmstick · SimmStick User Group Group Owner [ Edit My Membership ]
  Home  
* Messages  
     Pending  
     Post  
  Chat  
  Files  
  Photos  
  Links  
  Database  
  Polls  
  Members  
     Pending  
  Calendar  
 
 
  Promote  
  Invite  
 
 
  Management  
 
 
  owner = Owner 
  moderator = Moderator 
  online = Online 
 Messages Messages Help
Collapse Messages
 
  811-840 of 1612  |  Previous | Next  [ First | Last ]
 
 Msg #   Date  |  Thread
811

From: Don McKenzie  <don@dontronics.com>
Date: Fri Jul 27, 2001 8:50am
Subject: The STV5730A OSD chip is about to become obsolete

   
27-Jul-2001 The STV5730A OSD chip is about to become obsolete:
Information kindly supplied by Simon Blake of The BlackBoxCamera Company
Ltd.
We became aware of the situation recently.  We have been advised that
November is last orders meaning that 
delivery can be scheduled into next year for account customers.  We have
not decided on a replacement, but there will definitely be no
replacement from ST.  See the notice at http://www.wbc-europe.com/pcn
As such, when current stocks of the Dontronics DT108 board are sold,
there will be no immediate replacement.

Don McKenzie    mailto:don@d...      http://www.dontronics.com

The World's Largest Range of Atmel/AVR  & PICmicro Hardware and Software
Free Basic Compiler and Programmer http://www.dontronics.com/runavr.html
The Little "rAVeR!" AVR & Basic Kit http://www.dontronics.com/dt006.html


   
ADVERTISEMENT


812

From: Ray Bright  <rbright@icenet.com.au>
Date: Fri Jul 27, 2001 10:57am
Subject: Re: Can't run a LCD off a DT006

   
Thanks Ben for the clues it's comforting to find someone that has had
success with a Dick Smith module. I'll try the 10,000 uF across the supply
later today when I purchase one although the Raver is fitter with a 1,000uF.
I've actually tries a .01uF across the supply as a decoupling capacitor to
filter out any high frequency components with no success. Using a CRO the
power supply looks very clean at the LCD.
Have tried inserting the delays between lines of my original basic code
without success.
Your attachment actually came through as 2 files with the same name one
being 78 bytes & the other 2.18kb. The larger file downloaded to the Raver
ok and got the Raver LEDs flahing nicely but still the LCD only shows fully
shaded block characters ie every segment on as if the LCD RAM is not being
written to.
I see your LCD configuration is with all 8 data lines connected to the LCD,
have you got a Dick Smith module to work with only 4 bits?
So my problems still persist with this DSmith module as well as a 2x40
module although both LCD modules work fine direct from a parallel port
interface. May have to get desperate and see if I can get things working on
a DT104 pcb that I have or worst still drag out the CRO and start looking at
the timing of waveforms. Once again thanks for the response, appreciate any
further ideas that you may have.

----- Original Message -----
From: "Ben Hitchcock" <ben@w...>
To: <simmstick@yahoogroups.com>
Sent: Wednesday, July 25, 2001 6:39 AM
Subject: Re: [simmstick] Can't run a LCD off a DT006


> Hi Ray,
>
> I've been using the Dick Smith 2x16 LCD for a while, and there are some
> tricks you have to be aware of.  At the bottom of this email is a sample
> program (written in assembler, which is why I held off writing earlier),
> and attached is the compiled .hex file.
>
> Number one is to make sure you get the power supply working properly.
> This might not be a problem with your raver, but I certainly had
> problems until I put a whopping big 10000 uF capacitor across the supply
> rails.  Now when you turn the power off the LCD stays working for a
> couple of seconds, which shows how much reserve it has against noisy
> power supplies.
>
> Number two is to wait for a while (100 msec or so) after power-on before
> trying to talk to the LCD.  This seemed to help my system a lot.
>
> Number three is to do the initial power on procedure, and set the LCD to
> turn the insertion point on, and make it blink.  When the LCD blinks at
> you, you're nearly there...
>
> Then you should be set.  Look through my code, and download it to your
> AVR.  I know that this code works, but it is an earlier version to the
> one I'm working on now... trust me you don't want the version that talks
> to the LCD through some shift registers ;-)
>
> For the Dick Smith module,
> Connect LCD pins 7-14 to PORTB 0-7.
> Connect LCD pin 6 to PORTD 6
> Connect LCD pin 5 to ground.
> Connect LCD pin 4 to PORTD 5.
> Connect LCD pin 3 to the wiper of a 10k pot, the other ends of the pot
> go to +5V and ground.
> Connect LCD pin 2 to +5V
> Connect LCD pin 1 to ground.
>
> <Attachment missing>
>
> Good luck,
>
> Ben Hitchcock
>
> ------
> ;***********************************************************
> ;'
> ; LCD tacho, for use on automotive systems.
> ;
> ; This code is copyright 15/5/2000 Ben Hitchcock.
> ;  Feel free to use it however you see fit!
> ;
> ;***********************************************************
> ; Definitions
> ;*************
> .include "2313def.inc"
> .device AT90S2313
>
>
> .equ  rev_limit   =130  ; 13000 rpm.
> .equ  shift_limit =110  ; 11000 rpm.
>
> .def    delay    =r16    ;temporary register
> .def    delay1   =r17
> .def    delay2   =r18    ;temporary register
> .equ     RSPin    =6       ;Bit 6
> .equ     EPin     =5       ;Bit 5
>
> .equ     cutoff   =3       ;Bit 3
> .equ     shift_light  =2      ;Bit 2
> .def    temp    =r19      ;temporary register
> .def    temp_1  =r20
> .def    digit    =r24      ; temp storage for display RPM routine
> .def    temp_2 =r21      ;temporary register
> .def     character   =r22  ; character to put on LCD
> .def     counter     =r22  ; value of counter
> .def     displayPos  =r22  ; position to go to on the display
> .def     temp_3 =r23
> .def     rpm      =r25     ; Current rpm of the engine
> .def     portDbase   =r26  ; Pins that should be set in portD
>
> ;******************************
> ; Code
> ;******
> .cseg
>
> .org 0
>
> RESET:
>      rjmp START ; Reset vector bypass subroutines
> reti
> reti
> reti
> reti
> reti
> reti
> reti
> reti
> reti
> reti
>
>
>
>
> ;*************************************************************************
> ; Display setup
> ; Port D        bit             3       OE      Enable - clocks on neg
> transition
> ;                               2       RS      Register Select
> ;                                       command=0, data=1
> ;               bits    4-7     data    4 bits, high nibble first
> ;                                       ASCII format
> ;               RW grounded (write)
> ; Note that some commands take up to 1.6 msec for display to implement
> ; at a nominal display clock rate of 250 KHz
> ; Display initialize routine after power up
> ;
> ;************************************************************************
> ;
>
> START:
>           ldi r16,RAMEND      ;Init Stack Pointer (only needed for 2313)
>           out SPL,r16
>
>
>          ldi    temp,0b00000000 ; Start up with no outputs asserted.
>          out    PORTD,temp
>          ldi    temp, 0b00000000  ; None on portb either...
>          out    PORTB, temp
>
>          ldi     temp,0b11111111
>          out     DDRB,temp     ; PORTB = all outputs.
>          ldi    temp, 0b11101111
>          out    DDRD, temp     ; PORTD - RS, RW, and E.
>
> ldi     portDbase, 0b00000000  ; Make sure the shift light and
> ; rev limiter don't fire.
>
>          ldi temp, 0b00000111;
>          out TCCR0, temp
>                                   ;Load 1's into the Timer control
> register, to
>                                   ; enable the timer, and make it trigger
> on a
>                                   ; rising edge signal.
>                                   ; Now TCNT0 contains the value of the
> number of
>                                   ; double revolutions that happened
> since we last
>                                   ; reset the timer.
> ldi temp, 0b00001110;
>
> wdr ; Reset the watchdog.
> out WDTCR, temp ; Enable the watchdog timer.  This setting is about
> ; 1 second at 5V.
> wdr ; Reset the watchdog again...
>
>
>           ldi temp, 0b00100001    ; Start the counter at something
> vaguely appropriate
>           out TCNT0, temp
>
>
> ;
> ldi temp,50 ; Wait before turning on display.
> D1: ;
> rcall WAIT_2msec ;
>   rcall WAIT_2msec;
> rcall WAIT_2msec;
> dec temp
> brne D1
>
>          out portD, portDbase ;
>
> ldi temp,30 ; Wait at least 15msec after
> D2: ; powerup before writing
> rcall WAIT_2msec ; to display
>   rcall WAIT_2msec;
> rcall WAIT_2msec;
> dec temp
> brne D2
>
>
> wdr ; Reset the watchdog;
>
>          ldi    temp,0b00000000 ; Function set
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00111000  ; 2 line mode, 5x8 font
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>           rcall WAIT_2msec
>
>          ldi    temp,0b00000000 ; Display ON/OFF
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
> ;        ldi    temp, 0b00001111  ; display on, cursor on, blink on
>          ldi    temp, 0b00001100  ; display on, cursor off, blink off
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>          rcall WAIT_2msec
>
>          ldi    temp,0b00000000 ; Display Clear
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00000001  ; clear display
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>          rcall WAIT_2msec
>
>          ldi    temp,0b00000000 ; Entry mode set
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00000111  ; increment mode, entire shift on
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>        rcall WAIT_2msec;
>
>
> ;        ldi     temp,0b00001100 ; Display on, cursor/blink on
> ;        rcall   COMMAND_DISPLAY
>
>   ;       ldi temp, 0b
> ;
>
>
> ;*************************************************************************
> *******
> ;*************************************************************************
> *******
> ;***                               MAIN
> LOOP:                                 ***
> ;*************************************************************************
> *******
> ;*************************************************************************
> *******
> ENDLOOP:
>
>
>
>     wdr ; Reset the watchdog.
>
>     ldi   temp, 0          ; Reset counter
>     out   TCNT0, temp      ; Send 0 to counter
>
>                             ; Now wait until the counter increments, or
> we run out of patience...
>     ldi   temp, 0xFF        ;
>     ldi   temp_2, 0          ; So we can compare TCNT0 with 0.
> WAITLOOP1:
>     ldi   temp_1, 0xFF      ;
> WAITLOOP2:
>     in counter, TCNT0       ; Input the value of the counter
>     cp   temp_2, counter     ; Compare the counter to 0.
>     brlo  STARTTIMING       ; If the counter isn't 0, then we've got to
> start timing!
>     dec   temp_1            ; Decrement temp_1
>     brne  WAITLOOP2         ; Try again.
>     dec   temp              ; Decrease our outside loop
>     brne  WAITLOOP1         ; We're still trying...
>
>
>     ldi   rpm, 0            ; Give up - set the rpm to 0.
>     rjmp  ENDTIMING         ; Go to the rest of the loop.
>
> STARTTIMING:
>
>     rcall WAIT_2msec        ; Twiddle thumbs, waiting for engine to do a
> revolution
>     ldi   rpm, 150          ; Start at 15000 rpm.
>     ldi   temp_2, 1          ; So we can compare TCNT0 with 1.
>
> rpm15000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter    ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter > 1 then finish.
>     rcall WAIT_15usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 141          ; compare RPM to 14100 rpm...
>     brsh  rpm15000          ; If same or higher then keep counting.
>
> rpm14000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter > 1 then finish.
>     rcall WAIT_17usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 131          ; compare RPM to 13100 rpm...
>     brsh  rpm14000          ; If same or higher then keep counting.
>
>
> rpm13000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter > 1 then finish.
>     rcall WAIT_19usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 121          ; compare RPM to 12100 rpm...
>     brsh  rpm13000          ; If same or higher then keep counting.
>
> rpm12000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter > 1 then finish.
>     rcall WAIT_23usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 111          ; compare RPM to 11100 rpm...
>     brsh  rpm12000          ; If same or higher then keep counting.
>
> rpm11000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter > 1 then finish.
>     rcall WAIT_28usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 101          ; compare RPM to 10100 rpm...
>     brsh  rpm11000          ; If same or higher then keep counting.
>
> rpm10000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter >= 2 then finish.
>     rcall WAIT_34usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 91           ; compare RPM to 9100 rpm...
>     brsh  rpm10000          ; If same or higher then keep counting.
>
> rpm9000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter >= 2 then finish.
>     rcall WAIT_42usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 81           ; compare RPM to 8100 rpm...
>     brsh  rpm9000           ; If same or higher then keep counting.
>
>     rjmp rpm8000
> BRIDGE:
>     rjmp ENDTIMING
>
> rpm8000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_54usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 71           ; compare RPM to 7100 rpm...
>     brsh  rpm8000           ; If same or higher then keep counting.
>
> rpm7000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_72usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 61           ; compare RPM to 6100 rpm...
>     brsh  rpm7000           ; If same or higher then keep counting.
>
> rpm6000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_100usec      ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 51           ; compare RPM to 5100 rpm...
>     brsh  rpm6000           ; If same or higher then keep counting.
>
> rpm5000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_150usec      ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 41           ; compare RPM to 4100 rpm...
>     brsh  rpm5000           ; If same or higher then keep counting.
>
> rpm4000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_250usec      ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 31           ; compare RPM to 3100 rpm...
>     brsh  rpm4000           ; If same or higher then keep counting.
>
> rpm3000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_500usec      ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 21          ; compare RPM to 2100 rpm...
>     brsh  rpm3000          ; If same or higher then keep counting.
>
> rpm2000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_1500usec     ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 11           ; compare RPM to 1100 rpm...
>     brsh  rpm2000           ; If same or higher then keep counting.
>
> rpm1000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_6000usec     ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm,  1           ; compare RPM to 100 rpm...
>     brsh  rpm1000           ; If same or higher then keep counting.
>
> rjmp ENDLOOP
>
> ENDTIMING:
>
>     ldi   displayPos, 21       ; start at address 21
>     rcall CLEAR_DISPLAY
>
>     ldi   character, 0b01010101;   U
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01001111;   O
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01010111;   W
>
>     rcall DATA_DISPLAY;
>     ldi   character, 0b00100000;
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01010010;   R
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01100001;   a
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01100011;   c
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01101001;   i
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01101110;   n
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01100111;   g
>     rcall DATA_DISPLAY;
>     ldi   displayPos, 86       ; start at address 75
>     rcall SET_POSITION
>     rcall DISPLAY_RPM
>     ldi   character, 0b00110000;   0
>     rcall DATA_DISPLAY;
>     ldi   character, 0b00110000;   0
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01110010;   r
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01110000;   p
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01101101;   m
>     rcall DATA_DISPLAY;
> ;  rcall CLEAR_DISPLAY;
> ;   in   character, TCNT0     ; Our timer/counter
> ;   rcall DATA_DISPLAY;
>
>
>     cpi   rpm, rev_limit          ; Is the rpm too high?
>     brsh  limit_engine            ; If so, then stop the ignition
>
>     cbi   PORTD, cutoff           ; Otherwise, let the engine run.
>     cbr   portDbase, (1 << cutoff); Save the base portd pins
>     rjmp  check_shift_light       ; Skip the cutoff part
>
>
> limit_engine:
>     sbi   PORTD, cutoff           ; Turn off the engine
>     sbr   portDbase, (1 << cutoff); Save the base portd pins
>
> check_shift_light:
>     cpi rpm, shift_limit ; Is the rpm high enough to shift?
>     brsh set_shift_light      ; If so, then light up the shift light
>
>     cbi   PORTD, cutoff           ; Otherwise, turn off the shift light.
>     cbr   portDbase, (1 << shift_light); Save the base portd pins
>     rjmp  rest_of_main_loop       ; Skip the shift light part part
>
> set_shift_light:
>     sbi   PORTD, shift_light           ; Turn on the light
>     sbr   portDbase, (1 << shift_light); Save the base portd pins
>
>
> rest_of_main_loop:
>
> ldi temp,25  ; Wait a small amount before starting again
> end1: ;
> rcall WAIT_2msec ; to display
> dec temp
> brne end1
>
> rjmp ENDLOOP
> ;   in   rpm, TCNT0     ; Our timer/counter
> ;   ldi   temp, 0          ; Reset counter
> ;   out   TCNT0, temp      ; Send 0 to counter
>
>
>
>
>
> ;************************************************
> ;                   Subroutines
> ;************************************************
> ;
> ;
> ;************************************************
> ;           Display RPM
> ;
> ;  Loads the value of the timer into the LCD.
> ;  The frequency at which you call this subroutine
> ;  determines the time base of the counter.
> ;************************************************
> DISPLAY_RPM:
>
>     mov   temp_1, rpm       ; let the rest of the routine know the rpm.
>
>     ldi   digit, 0       ; Start at zero
> display_rpm_hundreds:
>
>     mov   temp_2, temp_1   ; load the number into temp_1
>     subi  temp_2,  100   ; Subtract 100 from the number.
>
>     brmi  send_hundreds_to_lcd ; If the result is less than 0, then
>                             ; skip the next bit.
>     inc   digit          ; Add 1 to digit.
>     mov  temp_1, temp_2    ; Decrease temp by 100.
>     rjmp  display_rpm_hundreds ; Now do the loop again.
>
> send_hundreds_to_lcd:
>     ori   digit, 0b00110000 ; Make the digit into something the
>                             ; LCD understands.
>     mov   character, digit  ;  Let the rest of the program know
>                             ; what's going on
>     rcall DATA_DISPLAY;
>
>     ldi   digit, 0       ; Start at zero
>     mov   temp_2, temp_1   ; load the number into temp_1
>
> display_rpm_tens:
>
>     subi  temp_2,  10   ; Subtract 10 from the number.
>
>     brmi  send_tens_to_lcd ; If the result is less than 0, then
>                             ; skip the next bit.
>     inc   digit          ; Add 1 to digit.
>     mov  temp_1, temp_2    ;
>     rjmp  display_rpm_tens ; Now do the loop again.
>
> send_tens_to_lcd:
>     ori   digit, 0b00110000 ; Make the digit into something the
>                             ; LCD understands.
>     mov   character, digit  ;  Let the rest of the program know
>                             ; what's going on
>     rcall DATA_DISPLAY;
>
> send_ones_to_lcd:
>     ori   temp_1, 0b00110000 ; Make the digit into something the
>                             ; LCD understands.
>     mov   character, temp_1  ;  Let the rest of the program know
>                             ; what's going on
>     rcall DATA_DISPLAY;
>
>     ret;
>
> ;
> ;
> ;******************************************************
> ;
> ; Writes data to display
> ; incorporates 50 usec delay
> ; data in temp
> ;
> ;********************************************************
> CLEAR_DISPLAY:
>
>          mov     temp_1,character     ; Copy data to temp_1
>
> ;          ldi    temp,0b00100000 ; Return Home
>            ldi    temp,0b00000000 ; Return Home
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00000010  ; Return home
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>        rcall WAIT_2msec;  Extra
>          cbi    PORTD, EPIN       ; Disable transfer
>
>        rcall WAIT_2msec;
> SET_POSITION:
>        rcall WAIT_2msec;   Extra
>         ldi    temp,0b00000000 ; Set DD Address
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b10000000  ; Set address
>          or    temp, displayPos  ; Load address into temp.
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; Disable transfer
>
>        rcall WAIT_2msec;
>        rcall WAIT_2msec;
>
>        ret;
>
>   DATA_DISPLAY:
>
>
>         ldi    temp,0b01000000 ; Write to data RAM
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          out    PORTB, character
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          cbi    PORTD, EPIN    ; Disable transfer
>
>
>          ldi     Delay,100       ; Wait about 50 usec
> D5:
>           nop;
> dec     Delay
>          brne    D5
> ;
>          ret     ; return
>
>
>
>
>
>
>
>
>
> ;*********************************************************************
> ; Delay 2 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_2msec:
>           ldi     Delay1,$0B         ; Slower this way
> D20002:
>          ldi     Delay2,$F4
> D20001:
>
>          dec     Delay2
>          brne    D20001
>          dec     Delay1
>          brne    D20002
>
>          ret
>
>
> ;*********************************************************************
> ; Delay 0.0145 msec with a 4MHz clock  (15-14)
> ;*********************************************************************
> WAIT_15usec:
>          ldi     Delay1,$0E
> testDelay:
>          dec     Delay1
>          brne    testDelay
>
>          ret
>
> ;*********************************************************************
> ; Delay 0.0165 msec with a 4MHz clock  (14-13)
> ;*********************************************************************
> WAIT_17usec:
>          ldi     Delay1,$11
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.019 msec with a 4MHz clock (13-12)
> ;*********************************************************************
> WAIT_19usec:
>           nop;
>           nop;  // For tuning...
>          ldi     Delay1,$15
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0225 msec with a 4MHz clock (12-11)
> ;*********************************************************************
> WAIT_23usec:
>          ldi     Delay1,$19
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0275 msec with a 4MHz clock (11-10)
> ;*********************************************************************
> WAIT_28usec:
>          ldi     Delay1,$20
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0335 msec with a 4MHz clock (10-9)
> ;*********************************************************************
> WAIT_34usec:
>          ldi     Delay1,$29
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0415 msec with a 4MHz clock (9-8)
> ;*********************************************************************
> WAIT_42usec:
>          ldi     Delay1,$33       ; (Was 34)
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0535 msec with a 4MHz clock (8-7)
> ;*********************************************************************
> WAIT_54usec:
>          ldi     Delay1,$44
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0715 msec with a 4MHz clock (7-6)
> ;*********************************************************************
> WAIT_72usec:
>          ldi     Delay1,$5B
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.1 msec with a 4MHz clock (6-5)
> ;*********************************************************************
> WAIT_100usec:
>          ldi    Delay2, $01
> D01001:
>          ldi     Delay1,$7F
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D01001;
>          ret;
>
> ;*********************************************************************
> ; Delay 0.15 msec with a 4MHz clock (5-4)
> ;*********************************************************************
> WAIT_150usec:
>          ldi    Delay2, $01
> D01501:
>          ldi     Delay1,$BE
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D01501;
>          ret;
>
> ;*********************************************************************
> ; Delay 0.25 msec with a 4MHz clock (4-3)
> ;*********************************************************************
> WAIT_250usec:
>          ldi    Delay2, $05
> D02501:
>          ldi     Delay1,$3F
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D02501;
>          ret;
>
> ;*********************************************************************
> ; Delay 0.5 msec with a 4MHz clock (3-2)
> ;*********************************************************************
> WAIT_500usec:
>          ldi    Delay2, $05
> D05001:
>          ldi     Delay1,$86
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D05001;
>          ret;
>
> ;*********************************************************************
> ; Delay 1.5 msec with a 4MHz clock (2-1)
> ;*********************************************************************
> WAIT_1500usec:
>          ldi    Delay2, $0F
> D15001:
>          ldi     Delay1,$8E ; (Was 80)
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D15001;
>          ret;
>
> ;*********************************************************************
> ; Delay 6.0 msec with a 4MHz clock (1-0)
> ;*********************************************************************
> WAIT_6000usec:
>          ldi    Delay2, $3C
> D60001:
>          ldi     Delay1,$80
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D60001;
>          ret;
>
>
>
>
>
>
> ;*********************************************************************
> ; Delay 4 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_4msec:
>           ldi     Delay1,$15         ; Slower this way
> D40002:
>          ldi     Delay2,$FA
> D40001:
>
>          dec     Delay2
>          brne    D40001
>          dec     Delay1
>          brne    D40002
>
>          ret
>
>
> ;*********************************************************************
> ; Delay 0.029 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_29usec:
>          ldi     Delay1,$1C
>          rjmp   testDelay;
>
>          ret
>
> ;*********************************************************************
> ; Delay 0.033 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_33usec:
>          ldi     Delay1,$28
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.038 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_38usec:
>          ldi     Delay1,$2F
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.045 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_45usec:
>          ldi     Delay1,$38
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.055 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_55usec:
>          ldi     Delay1,$45
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.067 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_67usec:
>          ldi     Delay1,$55
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.083 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_83usec:
>          ldi     Delay1,$69
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.107 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_107usec:
>          ldi     Delay1,$88
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.143 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_143usec:
>          ldi     Delay1,$B7
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.2 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_200usec:
>          ldi    Delay2, $02
> D02001:
>          ldi     Delay1,$7F
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D02001;
>          ret;
>
> ;*********************************************************************
> ; Delay 0.3 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_300usec:
>          ldi    Delay2, $03
> D03001:
>          ldi     Delay1,$7F
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D03001;
>          ret;
>
> ;*********************************************************************
> ; Delay 0.5 msec with a 4MHz clock
> ;*********************************************************************
> ;WAIT_500usec:
> ;        ldi    Delay2, $05
> ;D05001:
> ;        ldi     Delay1,$7F
> ;        rcall   testDelay; // Rcall (not rjmp) so it returns to us
> ;        dec    Delay2;
> ;        brne   D05001;
> ;        ret;
>
> ;*********************************************************************
> ; Delay 1.0 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_1000usec:
>          ldi    Delay2, $0A
> D10001:
>          ldi     Delay1,$7F
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D10001;
>          ret;
>
> ;*********************************************************************
> ; Delay 3.0 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_3000usec:
>          ldi    Delay2, $1E
> D30001:
>          ldi     Delay1,$80
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D30001;
>          ret;
>
> ;*********************************************************************
> ; Delay 12.0 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_12000usec:
>          ldi    Delay2, $78
> D120001:
>          ldi     Delay1,$80
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D120001;
>          ret;
>
>
> ------
> On Monday, July 23, 2001, at 10:09 PM, Ray Bright wrote:
>
> > Thanks for the response Don..... The problem occurs with both a Dick
> > Smith 2
> > x 16 LCD (catalog Z4170) and a 2 x 40 Sharp LM402-55. I don't know
> > about the
> > negative bias issue voltage issue, perhaps you could inform me further.
> > In desperation to prove the LCDs are not "blown" I tried the Printer
> > port to
> > LCD hardware & software set up off
> > wttp://ee.cleversoul.com/lcd_project.html
> > and both worked fine.
> > Really pulling out my hair on this one ....... Hope you or someone else
> > can
> > help further
> >
> > ----- Original Message -----
> > From: "Don McKenzie" <don@d...>
> > To: <simmstick@yahoogroups.com>
> > Sent: Sunday, July 22, 2001 3:11 PM
> > Subject: Re: [simmstick] Can't run a LCD off a DT006
> >
> >
> >>
> >>
> >>> Ray Bright wrote:
> >>>
> >>> I've assembled my Raver DT006 & it works as expected without any
> >>> problems but I'm having a problem interfacing to a 2 x 16 LCD.
> >>> Following the BASCOM AVR manual page 54 I've got it wired up ok and
> >>> I've been able to run the LCD.BAS example on page 140 in simulate mode
> >>> just fine but when I go to download it to the 2313 with a LCD
> >>> connected it downloads OK but I can't get the LCD to work. Is there
> >>> any common DT006 to LCD problem that I should be looking at.
> >>> I've tried inserting a $crystal = 4000000 in the code and putting 10K
> >>> pullups on the unused D4-D7, still won't work
> >>
> >> It is a standard LCD, not one of the ones that need a negative bias
> >> voltage?
> >> No, you don't need pullup resistors
> >>
> >> The bascom group may also be able to help also Ray.
> >> no real tricks to it, as long as you connect up and configure the pins
> >> correctly.
> >>
> >> Don McKenzie    mailto:don@d...
> >> http://www.dontronics.com
> >>
> >> The World's Largest Range of Atmel/AVR  & PICmicro Hardware and
> >> Software
> >> Free Basic Compiler and Programmer
> >> http://www.dontronics.com/runavr.html
> >> The Little "rAVeR!" AVR & Basic Kit
> >> http://www.dontronics.com/dt006.html
> >>
> >> To Post a message, send it to:   simmstick@e...
> >>
> >> To Unsubscribe, send a blank message to: simmstick-
> >> unsubscribe@e...
> >>
> >> Your use of Yahoo! Groups is subject to
> >> http://docs.yahoo.com/info/terms/
> >>
> >
> >
> > To Post a message, send it to:   simmstick@e...
> >
> > To Unsubscribe, send a blank message to: simmstick-
> > unsubscribe@e...
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
>


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


> Hi Ray,
>
> I've been using the Dick Smith 2x16 LCD for a while, and there are some
> tricks you have to be aware of.  At the bottom of this email is a sample
> program (written in assembler, which is why I held off writing earlier),
> and attached is the compiled .hex file.
>
> Number one is to make sure you get the power supply working properly.
> This might not be a problem with your raver, but I certainly had
> problems until I put a whopping big 10000 uF capacitor across the supply
> rails.  Now when you turn the power off the LCD stays working for a
> couple of seconds, which shows how much reserve it has against noisy
> power supplies.
>
> Number two is to wait for a while (100 msec or so) after power-on before
> trying to talk to the LCD.  This seemed to help my system a lot.
>
> Number three is to do the initial power on procedure, and set the LCD to
> turn the insertion point on, and make it blink.  When the LCD blinks at
> you, you're nearly there...
>
> Then you should be set.  Look through my code, and download it to your
> AVR.  I know that this code works, but it is an earlier version to the
> one I'm working on now... trust me you don't want the version that talks
> to the LCD through some shift registers ;-)
>
> For the Dick Smith module,
> Connect LCD pins 7-14 to PORTB 0-7.
> Connect LCD pin 6 to PORTD 6
> Connect LCD pin 5 to ground.
> Connect LCD pin 4 to PORTD 5.
> Connect LCD pin 3 to the wiper of a 10k pot, the other ends of the pot
> go to +5V and ground.
> Connect LCD pin 2 to +5V
> Connect LCD pin 1 to ground.
>
>


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


>
>
> Good luck,
>
> Ben Hitchcock
>
> ------
> ;***********************************************************
> ;'
> ; LCD tacho, for use on automotive systems.
> ;
> ; This code is copyright 15/5/2000 Ben Hitchcock.
> ;  Feel free to use it however you see fit!
> ;
> ;***********************************************************
> ; Definitions
> ;*************
> .include "2313def.inc"
> .device AT90S2313
>
>
> .equ  rev_limit   =130  ; 13000 rpm.
> .equ  shift_limit =110  ; 11000 rpm.
>
> .def    delay    =r16    ;temporary register
> .def    delay1   =r17
> .def    delay2   =r18    ;temporary register
> .equ     RSPin    =6       ;Bit 6
> .equ     EPin     =5       ;Bit 5
>
> .equ     cutoff   =3       ;Bit 3
> .equ     shift_light  =2      ;Bit 2
> .def    temp    =r19      ;temporary register
> .def    temp_1  =r20
> .def    digit    =r24      ; temp storage for display RPM routine
> .def    temp_2 =r21      ;temporary register
> .def     character   =r22  ; character to put on LCD
> .def     counter     =r22  ; value of counter
> .def     displayPos  =r22  ; position to go to on the display
> .def     temp_3 =r23
> .def     rpm      =r25     ; Current rpm of the engine
> .def     portDbase   =r26  ; Pins that should be set in portD
>
> ;******************************
> ; Code
> ;******
> .cseg
>
> .org 0
>
> RESET:
>      rjmp START ; Reset vector bypass subroutines
> reti
> reti
> reti
> reti
> reti
> reti
> reti
> reti
> reti
> reti
>
>
>
>
> ;*************************************************************************
> ; Display setup
> ; Port D        bit             3       OE      Enable - clocks on neg
> transition
> ;                               2       RS      Register Select
> ;                                       command=0, data=1
> ;               bits    4-7     data    4 bits, high nibble first
> ;                                       ASCII format
> ;               RW grounded (write)
> ; Note that some commands take up to 1.6 msec for display to implement
> ; at a nominal display clock rate of 250 KHz
> ; Display initialize routine after power up
> ;
> ;************************************************************************
> ;
>
> START:
>           ldi r16,RAMEND      ;Init Stack Pointer (only needed for 2313)
>           out SPL,r16
>
>
>          ldi    temp,0b00000000 ; Start up with no outputs asserted.
>          out    PORTD,temp
>          ldi    temp, 0b00000000  ; None on portb either...
>          out    PORTB, temp
>
>          ldi     temp,0b11111111
>          out     DDRB,temp     ; PORTB = all outputs.
>          ldi    temp, 0b11101111
>          out    DDRD, temp     ; PORTD - RS, RW, and E.
>
> ldi     portDbase, 0b00000000  ; Make sure the shift light and
> ; rev limiter don't fire.
>
>          ldi temp, 0b00000111;
>          out TCCR0, temp
>                                   ;Load 1's into the Timer control
> register, to
>                                   ; enable the timer, and make it trigger
> on a
>                                   ; rising edge signal.
>                                   ; Now TCNT0 contains the value of the
> number of
>                                   ; double revolutions that happened
> since we last
>                                   ; reset the timer.
> ldi temp, 0b00001110;
>
> wdr ; Reset the watchdog.
> out WDTCR, temp ; Enable the watchdog timer.  This setting is about
> ; 1 second at 5V.
> wdr ; Reset the watchdog again...
>
>
>           ldi temp, 0b00100001    ; Start the counter at something
> vaguely appropriate
>           out TCNT0, temp
>
>
> ;
> ldi temp,50 ; Wait before turning on display.
> D1: ;
> rcall WAIT_2msec ;
>   rcall WAIT_2msec;
> rcall WAIT_2msec;
> dec temp
> brne D1
>
>          out portD, portDbase ;
>
> ldi temp,30 ; Wait at least 15msec after
> D2: ; powerup before writing
> rcall WAIT_2msec ; to display
>   rcall WAIT_2msec;
> rcall WAIT_2msec;
> dec temp
> brne D2
>
>
> wdr ; Reset the watchdog;
>
>          ldi    temp,0b00000000 ; Function set
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00111000  ; 2 line mode, 5x8 font
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>           rcall WAIT_2msec
>
>          ldi    temp,0b00000000 ; Display ON/OFF
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
> ;        ldi    temp, 0b00001111  ; display on, cursor on, blink on
>          ldi    temp, 0b00001100  ; display on, cursor off, blink off
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>          rcall WAIT_2msec
>
>          ldi    temp,0b00000000 ; Display Clear
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00000001  ; clear display
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>          rcall WAIT_2msec
>
>          ldi    temp,0b00000000 ; Entry mode set
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00000111  ; increment mode, entire shift on
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>        rcall WAIT_2msec;
>
>
> ;        ldi     temp,0b00001100 ; Display on, cursor/blink on
> ;        rcall   COMMAND_DISPLAY
>
>   ;       ldi temp, 0b
> ;
>
>
> ;*************************************************************************
> *******
> ;*************************************************************************
> *******
> ;***                               MAIN
> LOOP:                                 ***
> ;*************************************************************************
> *******
> ;*************************************************************************
> *******
> ENDLOOP:
>
>
>
>     wdr ; Reset the watchdog.
>
>     ldi   temp, 0          ; Reset counter
>     out   TCNT0, temp      ; Send 0 to counter
>
>                             ; Now wait until the counter increments, or
> we run out of patience...
>     ldi   temp, 0xFF        ;
>     ldi   temp_2, 0          ; So we can compare TCNT0 with 0.
> WAITLOOP1:
>     ldi   temp_1, 0xFF      ;
> WAITLOOP2:
>     in counter, TCNT0       ; Input the value of the counter
>     cp   temp_2, counter     ; Compare the counter to 0.
>     brlo  STARTTIMING       ; If the counter isn't 0, then we've got to
> start timing!
>     dec   temp_1            ; Decrement temp_1
>     brne  WAITLOOP2         ; Try again.
>     dec   temp              ; Decrease our outside loop
>     brne  WAITLOOP1         ; We're still trying...
>
>
>     ldi   rpm, 0            ; Give up - set the rpm to 0.
>     rjmp  ENDTIMING         ; Go to the rest of the loop.
>
> STARTTIMING:
>
>     rcall WAIT_2msec        ; Twiddle thumbs, waiting for engine to do a
> revolution
>     ldi   rpm, 150          ; Start at 15000 rpm.
>     ldi   temp_2, 1          ; So we can compare TCNT0 with 1.
>
> rpm15000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter    ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter > 1 then finish.
>     rcall WAIT_15usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 141          ; compare RPM to 14100 rpm...
>     brsh  rpm15000          ; If same or higher then keep counting.
>
> rpm14000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter > 1 then finish.
>     rcall WAIT_17usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 131          ; compare RPM to 13100 rpm...
>     brsh  rpm14000          ; If same or higher then keep counting.
>
>
> rpm13000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter > 1 then finish.
>     rcall WAIT_19usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 121          ; compare RPM to 12100 rpm...
>     brsh  rpm13000          ; If same or higher then keep counting.
>
> rpm12000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter > 1 then finish.
>     rcall WAIT_23usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 111          ; compare RPM to 11100 rpm...
>     brsh  rpm12000          ; If same or higher then keep counting.
>
> rpm11000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter > 1 then finish.
>     rcall WAIT_28usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 101          ; compare RPM to 10100 rpm...
>     brsh  rpm11000          ; If same or higher then keep counting.
>
> rpm10000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter >= 2 then finish.
>     rcall WAIT_34usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 91           ; compare RPM to 9100 rpm...
>     brsh  rpm10000          ; If same or higher then keep counting.
>
> rpm9000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  BRIDGE            ; If the counter >= 2 then finish.
>     rcall WAIT_42usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 81           ; compare RPM to 8100 rpm...
>     brsh  rpm9000           ; If same or higher then keep counting.
>
>     rjmp rpm8000
> BRIDGE:
>     rjmp ENDTIMING
>
> rpm8000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_54usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 71           ; compare RPM to 7100 rpm...
>     brsh  rpm8000           ; If same or higher then keep counting.
>
> rpm7000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_72usec       ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 61           ; compare RPM to 6100 rpm...
>     brsh  rpm7000           ; If same or higher then keep counting.
>
> rpm6000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_100usec      ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 51           ; compare RPM to 5100 rpm...
>     brsh  rpm6000           ; If same or higher then keep counting.
>
> rpm5000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_150usec      ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 41           ; compare RPM to 4100 rpm...
>     brsh  rpm5000           ; If same or higher then keep counting.
>
> rpm4000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_250usec      ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 31           ; compare RPM to 3100 rpm...
>     brsh  rpm4000           ; If same or higher then keep counting.
>
> rpm3000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_500usec      ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 21          ; compare RPM to 2100 rpm...
>     brsh  rpm3000          ; If same or higher then keep counting.
>
> rpm2000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_1500usec     ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm, 11           ; compare RPM to 1100 rpm...
>     brsh  rpm2000           ; If same or higher then keep counting.
>
> rpm1000:
>     in    counter, TCNT0    ; Input the value of the counter
>     cp    temp_2, counter   ; Compare the counter with the value '1'.
>     brlo  ENDTIMING         ; If the counter >= 2 then finish.
>     rcall WAIT_6000usec     ; Wait a bit...
>     dec   rpm               ; Decrease rpm by 1
>     cpi   rpm,  1           ; compare RPM to 100 rpm...
>     brsh  rpm1000           ; If same or higher then keep counting.
>
> rjmp ENDLOOP
>
> ENDTIMING:
>
>     ldi   displayPos, 21       ; start at address 21
>     rcall CLEAR_DISPLAY
>
>     ldi   character, 0b01010101;   U
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01001111;   O
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01010111;   W
>
>     rcall DATA_DISPLAY;
>     ldi   character, 0b00100000;
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01010010;   R
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01100001;   a
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01100011;   c
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01101001;   i
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01101110;   n
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01100111;   g
>     rcall DATA_DISPLAY;
>     ldi   displayPos, 86       ; start at address 75
>     rcall SET_POSITION
>     rcall DISPLAY_RPM
>     ldi   character, 0b00110000;   0
>     rcall DATA_DISPLAY;
>     ldi   character, 0b00110000;   0
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01110010;   r
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01110000;   p
>     rcall DATA_DISPLAY;
>     ldi   character, 0b01101101;   m
>     rcall DATA_DISPLAY;
> ;  rcall CLEAR_DISPLAY;
> ;   in   character, TCNT0     ; Our timer/counter
> ;   rcall DATA_DISPLAY;
>
>
>     cpi   rpm, rev_limit          ; Is the rpm too high?
>     brsh  limit_engine            ; If so, then stop the ignition
>
>     cbi   PORTD, cutoff           ; Otherwise, let the engine run.
>     cbr   portDbase, (1 << cutoff); Save the base portd pins
>     rjmp  check_shift_light       ; Skip the cutoff part
>
>
> limit_engine:
>     sbi   PORTD, cutoff           ; Turn off the engine
>     sbr   portDbase, (1 << cutoff); Save the base portd pins
>
> check_shift_light:
>     cpi rpm, shift_limit ; Is the rpm high enough to shift?
>     brsh set_shift_light      ; If so, then light up the shift light
>
>     cbi   PORTD, cutoff           ; Otherwise, turn off the shift light.
>     cbr   portDbase, (1 << shift_light); Save the base portd pins
>     rjmp  rest_of_main_loop       ; Skip the shift light part part
>
> set_shift_light:
>     sbi   PORTD, shift_light           ; Turn on the light
>     sbr   portDbase, (1 << shift_light); Save the base portd pins
>
>
> rest_of_main_loop:
>
> ldi temp,25  ; Wait a small amount before starting again
> end1: ;
> rcall WAIT_2msec ; to display
> dec temp
> brne end1
>
> rjmp ENDLOOP
> ;   in   rpm, TCNT0     ; Our timer/counter
> ;   ldi   temp, 0          ; Reset counter
> ;   out   TCNT0, temp      ; Send 0 to counter
>
>
>
>
>
> ;************************************************
> ;                   Subroutines
> ;************************************************
> ;
> ;
> ;************************************************
> ;           Display RPM
> ;
> ;  Loads the value of the timer into the LCD.
> ;  The frequency at which you call this subroutine
> ;  determines the time base of the counter.
> ;************************************************
> DISPLAY_RPM:
>
>     mov   temp_1, rpm       ; let the rest of the routine know the rpm.
>
>     ldi   digit, 0       ; Start at zero
> display_rpm_hundreds:
>
>     mov   temp_2, temp_1   ; load the number into temp_1
>     subi  temp_2,  100   ; Subtract 100 from the number.
>
>     brmi  send_hundreds_to_lcd ; If the result is less than 0, then
>                             ; skip the next bit.
>     inc   digit          ; Add 1 to digit.
>     mov  temp_1, temp_2    ; Decrease temp by 100.
>     rjmp  display_rpm_hundreds ; Now do the loop again.
>
> send_hundreds_to_lcd:
>     ori   digit, 0b00110000 ; Make the digit into something the
>                             ; LCD understands.
>     mov   character, digit  ;  Let the rest of the program know
>                             ; what's going on
>     rcall DATA_DISPLAY;
>
>     ldi   digit, 0       ; Start at zero
>     mov   temp_2, temp_1   ; load the number into temp_1
>
> display_rpm_tens:
>
>     subi  temp_2,  10   ; Subtract 10 from the number.
>
>     brmi  send_tens_to_lcd ; If the result is less than 0, then
>                             ; skip the next bit.
>     inc   digit          ; Add 1 to digit.
>     mov  temp_1, temp_2    ;
>     rjmp  display_rpm_tens ; Now do the loop again.
>
> send_tens_to_lcd:
>     ori   digit, 0b00110000 ; Make the digit into something the
>                             ; LCD understands.
>     mov   character, digit  ;  Let the rest of the program know
>                             ; what's going on
>     rcall DATA_DISPLAY;
>
> send_ones_to_lcd:
>     ori   temp_1, 0b00110000 ; Make the digit into something the
>                             ; LCD understands.
>     mov   character, temp_1  ;  Let the rest of the program know
>                             ; what's going on
>     rcall DATA_DISPLAY;
>
>     ret;
>
> ;
> ;
> ;******************************************************
> ;
> ; Writes data to display
> ; incorporates 50 usec delay
> ; data in temp
> ;
> ;********************************************************
> CLEAR_DISPLAY:
>
>          mov     temp_1,character     ; Copy data to temp_1
>
> ;          ldi    temp,0b00100000 ; Return Home
>            ldi    temp,0b00000000 ; Return Home
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00000010  ; Return home
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>        rcall WAIT_2msec;  Extra
>          cbi    PORTD, EPIN       ; Disable transfer
>
>        rcall WAIT_2msec;
> SET_POSITION:
>        rcall WAIT_2msec;   Extra
>         ldi    temp,0b00000000 ; Set DD Address
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b10000000  ; Set address
>          or    temp, displayPos  ; Load address into temp.
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; Disable transfer
>
>        rcall WAIT_2msec;
>        rcall WAIT_2msec;
>
>        ret;
>
>   DATA_DISPLAY:
>
>
>         ldi    temp,0b01000000 ; Write to data RAM
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          out    PORTB, character
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          cbi    PORTD, EPIN    ; Disable transfer
>
>
>          ldi     Delay,100       ; Wait about 50 usec
> D5:
>           nop;
> dec     Delay
>          brne    D5
> ;
>          ret     ; return
>
>
>
>
>
>
>
>
>
> ;*********************************************************************
> ; Delay 2 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_2msec:
>           ldi     Delay1,$0B         ; Slower this way
> D20002:
>          ldi     Delay2,$F4
> D20001:
>
>          dec     Delay2
>          brne    D20001
>          dec     Delay1
>          brne    D20002
>
>          ret
>
>
> ;*********************************************************************
> ; Delay 0.0145 msec with a 4MHz clock  (15-14)
> ;*********************************************************************
> WAIT_15usec:
>          ldi     Delay1,$0E
> testDelay:
>          dec     Delay1
>          brne    testDelay
>
>          ret
>
> ;*********************************************************************
> ; Delay 0.0165 msec with a 4MHz clock  (14-13)
> ;*********************************************************************
> WAIT_17usec:
>          ldi     Delay1,$11
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.019 msec with a 4MHz clock (13-12)
> ;*********************************************************************
> WAIT_19usec:
>           nop;
>           nop;  // For tuning...
>          ldi     Delay1,$15
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0225 msec with a 4MHz clock (12-11)
> ;*********************************************************************
> WAIT_23usec:
>          ldi     Delay1,$19
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0275 msec with a 4MHz clock (11-10)
> ;*********************************************************************
> WAIT_28usec:
>          ldi     Delay1,$20
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0335 msec with a 4MHz clock (10-9)
> ;*********************************************************************
> WAIT_34usec:
>          ldi     Delay1,$29
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0415 msec with a 4MHz clock (9-8)
> ;*********************************************************************
> WAIT_42usec:
>          ldi     Delay1,$33       ; (Was 34)
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0535 msec with a 4MHz clock (8-7)
> ;*********************************************************************
> WAIT_54usec:
>          ldi     Delay1,$44
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.0715 msec with a 4MHz clock (7-6)
> ;*********************************************************************
> WAIT_72usec:
>          ldi     Delay1,$5B
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.1 msec with a 4MHz clock (6-5)
> ;*********************************************************************
> WAIT_100usec:
>          ldi    Delay2, $01
> D01001:
>          ldi     Delay1,$7F
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D01001;
>          ret;
>
> ;*********************************************************************
> ; Delay 0.15 msec with a 4MHz clock (5-4)
> ;*********************************************************************
> WAIT_150usec:
>          ldi    Delay2, $01
> D01501:
>          ldi     Delay1,$BE
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D01501;
>          ret;
>
> ;*********************************************************************
> ; Delay 0.25 msec with a 4MHz clock (4-3)
> ;*********************************************************************
> WAIT_250usec:
>          ldi    Delay2, $05
> D02501:
>          ldi     Delay1,$3F
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D02501;
>          ret;
>
> ;*********************************************************************
> ; Delay 0.5 msec with a 4MHz clock (3-2)
> ;*********************************************************************
> WAIT_500usec:
>          ldi    Delay2, $05
> D05001:
>          ldi     Delay1,$86
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D05001;
>          ret;
>
> ;*********************************************************************
> ; Delay 1.5 msec with a 4MHz clock (2-1)
> ;*********************************************************************
> WAIT_1500usec:
>          ldi    Delay2, $0F
> D15001:
>          ldi     Delay1,$8E ; (Was 80)
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D15001;
>          ret;
>
> ;*********************************************************************
> ; Delay 6.0 msec with a 4MHz clock (1-0)
> ;*********************************************************************
> WAIT_6000usec:
>          ldi    Delay2, $3C
> D60001:
>          ldi     Delay1,$80
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D60001;
>          ret;
>
>
>
>
>
>
> ;*********************************************************************
> ; Delay 4 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_4msec:
>           ldi     Delay1,$15         ; Slower this way
> D40002:
>          ldi     Delay2,$FA
> D40001:
>
>          dec     Delay2
>          brne    D40001
>          dec     Delay1
>          brne    D40002
>
>          ret
>
>
> ;*********************************************************************
> ; Delay 0.029 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_29usec:
>          ldi     Delay1,$1C
>          rjmp   testDelay;
>
>          ret
>
> ;*********************************************************************
> ; Delay 0.033 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_33usec:
>          ldi     Delay1,$28
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.038 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_38usec:
>          ldi     Delay1,$2F
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.045 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_45usec:
>          ldi     Delay1,$38
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.055 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_55usec:
>          ldi     Delay1,$45
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.067 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_67usec:
>          ldi     Delay1,$55
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.083 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_83usec:
>          ldi     Delay1,$69
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.107 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_107usec:
>          ldi     Delay1,$88
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.143 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_143usec:
>          ldi     Delay1,$B7
>          rjmp   testDelay;
>
> ;*********************************************************************
> ; Delay 0.2 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_200usec:
>          ldi    Delay2, $02
> D02001:
>          ldi     Delay1,$7F
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D02001;
>          ret;
>
> ;*********************************************************************
> ; Delay 0.3 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_300usec:
>          ldi    Delay2, $03
> D03001:
>          ldi     Delay1,$7F
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D03001;
>          ret;
>
> ;*********************************************************************
> ; Delay 0.5 msec with a 4MHz clock
> ;*********************************************************************
> ;WAIT_500usec:
> ;        ldi    Delay2, $05
> ;D05001:
> ;        ldi     Delay1,$7F
> ;        rcall   testDelay; // Rcall (not rjmp) so it returns to us
> ;        dec    Delay2;
> ;        brne   D05001;
> ;        ret;
>
> ;*********************************************************************
> ; Delay 1.0 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_1000usec:
>          ldi    Delay2, $0A
> D10001:
>          ldi     Delay1,$7F
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D10001;
>          ret;
>
> ;*********************************************************************
> ; Delay 3.0 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_3000usec:
>          ldi    Delay2, $1E
> D30001:
>          ldi     Delay1,$80
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D30001;
>          ret;
>
> ;*********************************************************************
> ; Delay 12.0 msec with a 4MHz clock
> ;*********************************************************************
> WAIT_12000usec:
>          ldi    Delay2, $78
> D120001:
>          ldi     Delay1,$80
>          rcall   testDelay; // Rcall (not rjmp) so it returns to us
>          dec    Delay2;
>          brne   D120001;
>          ret;
>
>
> ------
> On Monday, July 23, 2001, at 10:09 PM, Ray Bright wrote:
>
> > Thanks for the response Don..... The problem occurs with both a Dick
> > Smith 2
> > x 16 LCD (catalog Z4170) and a 2 x 40 Sharp LM402-55. I don't know
> > about the
> > negative bias issue voltage issue, perhaps you could inform me further.
> > In desperation to prove the LCDs are not "blown" I tried the Printer
> > port to
> > LCD hardware & software set up off
> > wttp://ee.cleversoul.com/lcd_project.html
> > and both worked fine.
> > Really pulling out my hair on this one ....... Hope you or someone else
> > can
> > help further
> >
> > ----- Original Message -----
> > From: "Don McKenzie" <don@d...>
> > To: <simmstick@yahoogroups.com>
> > Sent: Sunday, July 22, 2001 3:11 PM
> > Subject: Re: [simmstick] Can't run a LCD off a DT006
> >
> >
> >>
> >>
> >>> Ray Bright wrote:
> >>>
> >>> I've assembled my Raver DT006 & it works as expected without any
> >>> problems but I'm having a problem interfacing to a 2 x 16 LCD.
> >>> Following the BASCOM AVR manual page 54 I've got it wired up ok and
> >>> I've been able to run the LCD.BAS example on page 140 in simulate mode
> >>> just fine but when I go to download it to the 2313 with a LCD
> >>> connected it downloads OK but I can't get the LCD to work. Is there
> >>> any common DT006 to LCD problem that I should be looking at.
> >>> I've tried inserting a $crystal = 4000000 in the code and putting 10K
> >>> pullups on the unused D4-D7, still won't work
> >>
> >> It is a standard LCD, not one of the ones that need a negative bias
> >> voltage?
> >> No, you don't need pullup resistors
> >>
> >> The bascom group may also be able to help also Ray.
> >> no real tricks to it, as long as you connect up and configure the pins
> >> correctly.
> >>
> >> Don McKenzie    mailto:don@d...
> >> http://www.dontronics.com
> >>
> >> The World's Largest Range of Atmel/AVR  & PICmicro Hardware and
> >> Software
> >> Free Basic Compiler and Programmer
> >> http://www.dontronics.com/runavr.html
> >> The Little "rAVeR!" AVR & Basic Kit
> >> http://www.dontronics.com/dt006.html
> >>
> >> To Post a message, send it to:   simmstick@e...
> >>
> >> To Unsubscribe, send a blank message to: simmstick-
> >> unsubscribe@e...
> >>
> >> Your use of Yahoo! Groups is subject to
> >> http://docs.yahoo.com/info/terms/
> >>
> >
> >
> > To Post a message, send it to:   simmstick@e...
> >
> > To Unsubscribe, send a blank message to: simmstick-
> > unsubscribe@e...
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
>
813

From: R Severson  <severson@starband.net>
Date: Fri Jul 27, 2001 11:24am
Subject: RE: The STV5730A OSD chip is about to become obsolete

   
Bad news for the BOB II module too, right?

I have 1 more DT108 than 5730...

The Philips PCS8514 is/will be gone too.

-Rob

> -----Original Message-----
> From: Don McKenzie [mailto:don@d...]
> Sent: Thursday, July 26, 2001 5:51 PM
> To: SimmStick Group
> Subject: [simmstick] The STV5730A OSD chip is 
> about to become obsolete
> 
> 
> 
> 
> 27-Jul-2001 The STV5730A OSD chip is about to 
> become obsolete:
> Information kindly supplied by Simon Blake of The 
> BlackBoxCamera Company
> Ltd.
> We became aware of the situation recently.  We 
> have been advised that
> November is last orders meaning that 
> delivery can be scheduled into next year for 
> account customers.  We have
> not decided on a replacement, but there will 
> definitely be no
> replacement from ST.  See the notice at 
> http://www.wbc-europe.com/pcn
> As such, when current stocks of the Dontronics 
> DT108 board are sold,
> there will be no immediate replacement.
> 
> Don McKenzie    mailto:don@d...      
> http://www.dontronics.com
> 
> The World's Largest Range of Atmel/AVR  & 
> PICmicro Hardware and Software
> Free Basic Compiler and Programmer 
> http://www.dontronics.com/runavr.html
> The Little "rAVeR!" AVR & Basic Kit 
> http://www.dontronics.com/dt006.html
> 
> ------------------------ Yahoo! Groups Sponsor 
> 
> To Post a message, send it to:   simmstick@e...
> 
> To Unsubscribe, send a blank message to: 
> simmstick-unsubscribe@e... 
> 
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ 
> 
>
814

From: Don McKenzie  <don@dontronics.com>
Date: Fri Jul 27, 2001 0:24pm
Subject: PIXIE Visual Development and Full PIC C Compiler.

   
27-Jul-2001 
PIXIE Visual Development and Full PIC C Compiler. 
The FED C Compiler and PIXIE will handle any of the current 14 bit PIC's
and PIC18CXXX 16 bit core PIC's future devices may be added by changing
a single data file and downloading the new C header file. 
http://www.dontronics.com/fed.html 

Don McKenzie    mailto:don@d...      http://www.dontronics.com

The World's Largest Range of Atmel/AVR  & PICmicro Hardware and Software
Free Basic Compiler and Programmer http://www.dontronics.com/runavr.html
The Little "rAVeR!" AVR & Basic Kit http://www.dontronics.com/dt006.html
815

From: Ben Hitchcock  <benhi98@wollongong.apana.org.au>
Date: Sat Jul 28, 2001 11:18am
Subject: Re: Can't run a LCD off a DT006

   
Hi,



> Have tried inserting the delays between lines of my original basic code
> without success.
> Your attachment actually came through as 2 files with the same name one
> being 78 bytes & the other 2.18kb. The larger file downloaded to the
> Raver
> ok and got the Raver LEDs flahing nicely but still the LCD only shows
> fully
> shaded block characters ie every segment on as if the LCD RAM is not
> being written to.

I'm using MacOS X now, nad still haven't worked out some of the kinks...
I take it you wired up the LCD module as per the connection
diagram?  Specifically, portD 5 (pin 9) and portD 6 (pin 11)?
Are you using an AT90S2313?

> I see your LCD configuration is with all 8 data lines connected to the
> LCD, have you got a Dick Smith module to work with only 4 bits?

Nope.  I couldn't see how to do it using the data supplied with the Dick
Smith module, so I did it with a shift register (2 lines instead of 4).

> So my problems still persist with this DSmith module as well as a 2x40
> module although both LCD modules work fine direct from a parallel port
> interface. May have to get desperate and see if I can get things working
> on
> a DT104 pcb that I have or worst still drag out the CRO and start
> looking at
> the timing of waveforms. Once again thanks for the response, appreciate
> any further ideas that you may have.

Have you had a dig through www.avrfreaks.net?

Good luck,

Ben
816

From: Mike DeMetz  <miked@elkhart.net>
Date: Sat Jul 28, 2001 11:43am
Subject: RE: The STV5730A OSD chip is about to become obsolete

   
And Intuitive Circuits line of OSD devices.

> Bad news for the BOB II module too, right?
> 
> I have 1 more DT108 than 5730...
> 
> The Philips PCS8514 is/will be gone too.
> 
> -Rob
>
817

From: Don McKenzie  <don@dontronics.com>
Date: Sat Jul 28, 2001 1:01pm
Subject: Re: The STV5730A OSD chip is about to become obsolete

   
Mike DeMetz wrote:
> 
> And Intuitive Circuits line of OSD devices.
> 
> > Bad news for the BOB II module too, right?
> >
> > I have 1 more DT108 than 5730...
> >
> > The Philips PCS8514 is/will be gone too.
> >
> > -Rob

I spoke to Mike Hardwick at Decade Engineering (Bob-II), and he was well
aware of it, and says he will design his own cct, so he doesn't have to
depend on companies that decide that it is no longer viable to produce a
specific chip. 

Trouble is companies like ST no doubt sell in 100K+ quantities, and if
order levels drop, they drop production.

prior to Lionel Theunissen coming up with the dt108 board, Nigel Goodwin
was having a look at much the same project for me, but using an
alternative OSD chip. This fell into a hole because of sourcing problems
with that chip. Forget what it was now, as it goes back 3 or 4 years.

Perhaps Mike Hardwick is right, but I dare say it will be a bit of a
monster schematic.

Don McKenzie    mailto:don@d...      http://www.dontronics.com

The World's Largest Range of Atmel/AVR  & PICmicro Hardware and Software
Free Basic Compiler and Programmer http://www.dontronics.com/runavr.html
The Little "rAVeR!" AVR & Basic Kit http://www.dontronics.com/dt006.html
818

From: Nigel Goodwin  <nigelg@lpilsley.co.uk>
Date: Sun Jul 29, 2001 3:39am
Subject: Re: The STV5730A OSD chip is about to become obsolete

   
In message <3B622AF5.882FBC95@d...>, Don McKenzie
<don@d...> writes
>prior to Lionel Theunissen coming up with the dt108 board, Nigel Goodwin
>was having a look at much the same project for me, but using an
>alternative OSD chip. This fell into a hole because of sourcing problems
>with that chip. Forget what it was now, as it goes back 3 or 4 years.

Hi Don,

It was an NEC chip I was using, I've managed to get hold of a few out of
old Hitachi VCR's - enough for my requirements. I never did manage to
get a sample of the later NEC chip, so I gave up :-(.
-- 

Nigel.

        /--------------------------------------------------------------\
        | Nigel Goodwin   | Internet : nigelg@l...           |
        | Lower Pilsley   | Web Page : http://www.lpilsley.co.uk       |
        | Chesterfield    | Official site for Shin Ki and New Spirit   |
        | England         |                 Ju Jitsu                   |
        \--------------------------------------------------------------/
819

From: Mike DeMetz  <miked@elkhart.net>
Date: Sun Jul 29, 2001 10:46am
Subject: Re: The STV5730A OSD chip is about to become obsolete

   
I the BOB-I used a Rhom chip, which is obsolete I assume? 
> I spoke to Mike Hardwick at Decade Engineering (Bob-II), and he was well
> aware of it, and says he will design his own cct, so he doesn't have to
> depend on companies that decide that it is no longer viable to produce a
> specific chip. 
> 
> Trouble is companies like ST no doubt sell in 100K+ quantities, and if
> order levels drop, they drop production.
I had some code from someone  for a NEC chip(made for VCRs), later 
changed for a different NEC chip since the first went out of production
> prior to Lionel Theunissen coming up with the dt108 board, Nigel Goodwin
> was having a look at much the same project for me, but using an
> alternative OSD chip. This fell into a hole because of sourcing problems
> with that chip. Forget what it was now, as it goes back 3 or 4 years.
Anyone know what the ITU Technologies OSD used? It was one of the 
smallest and cheapest.
> Perhaps Mike Hardwick is right, but I dare say it will be a bit of a
> monster schematic.
> 
> Don McKenzie    mailto:don@d...      http://www.dontronics.com
820

From: Ray Bright  <rbright@icenet.com.au>
Date: Sun Jul 29, 2001 11:36pm
Subject: Success to - Can't run a LCD off a DT006

   
After building up the hardware to work off a DT104 I found that no D5 & D6
data was getting out onto the SIMM connector of the DT006 because J14 links
were missing. Opps......
Ben thanks for the excellent sample code - in your advice for the Dick Smith
module I think you have "Connect LCD pin 6 to PORTD 6 and Connect LCD pin 4
to PORTD 5" maybe reversed.
Thanks to everone who contibuted to my call for assistance


----- Original Message -----
From: "Ben Hitchcock" <ben@w...>
To: <simmstick@yahoogroups.com>
Sent: Wednesday, July 25, 2001 6:39 AM
Subject: Re: [simmstick] Can't run a LCD off a DT006


> Hi Ray,
>
> I've been using the Dick Smith 2x16 LCD for a while, and there are some
> tricks you have to be aware of.  At the bottom of this email is a sample
> program (written in assembler, which is why I held off writing earlier),
> and attached is the compiled .hex file.
>
> Number one is to make sure you get the power supply working properly.
> This might not be a problem with your raver, but I certainly had
> problems until I put a whopping big 10000 uF capacitor across the supply
> rails.  Now when you turn the power off the LCD stays working for a
> couple of seconds, which shows how much reserve it has against noisy
> power supplies.
>
> Number two is to wait for a while (100 msec or so) after power-on before
> trying to talk to the LCD.  This seemed to help my system a lot.
>
> Number three is to do the initial power on procedure, and set the LCD to
> turn the insertion point on, and make it blink.  When the LCD blinks at
> you, you're nearly there...
>
> Then you should be set.  Look through my code, and download it to your
> AVR.  I know that this code works, but it is an earlier version to the
> one I'm working on now... trust me you don't want the version that talks
> to the LCD through some shift registers ;-)
>
> For the Dick Smith module,
> Connect LCD pins 7-14 to PORTB 0-7.
> Connect LCD pin 6 to PORTD 6
> Connect LCD pin 5 to ground.
> Connect LCD pin 4 to PORTD 5.
> Connect LCD pin 3 to the wiper of a 10k pot, the other ends of the pot
> go to +5V and ground.
> Connect LCD pin 2 to +5V
> Connect LCD pin 1 to ground.
>
> <Attachment missing>
>
> Good luck,
>
> Ben Hitchcock
>
> ------
> ;***********************************************************
> ;'
> ; LCD tacho, for use on automotive systems.
> ;
> ; This code is copyright 15/5/2000 Ben Hitchcock.
> ;  Feel free to use it however you see fit!
> ;
> ;***********************************************************
> ; Definitions
> ;*************
> .include "2313def.inc"
> .device AT90S2313
>
>
> .equ  rev_limit   =130  ; 13000 rpm.
> .equ  shift_limit =110  ; 11000 rpm.
>
> .def    delay    =r16    ;temporary register
> .def    delay1   =r17
> .def    delay2   =r18    ;temporary register
> .equ     RSPin    =6       ;Bit 6
> .equ     EPin     =5       ;Bit 5
>
> .equ     cutoff   =3       ;Bit 3
> .equ     shift_light  =2      ;Bit 2
> .def    temp    =r19      ;temporary register
> .def    temp_1  =r20
> .def    digit    =r24      ; temp storage for display RPM routine
> .def    temp_2 =r21      ;temporary register
> .def     character   =r22  ; character to put on LCD
> .def     counter     =r22  ; value of counter
> .def     displayPos  =r22  ; position to go to on the display
> .def     temp_3 =r23
> .def     rpm      =r25     ; Current rpm of the engine
> .def     portDbase   =r26  ; Pins that should be set in portD
>
> ;******************************
> ; Code
> ;******
> .cseg
>
> .org 0
>
> RESET:
>      rjmp START ; Reset vector bypass subroutines
> reti
> reti
> reti
> reti
> reti
> reti
> reti
> reti
> reti
> reti
>
>
>
>
> ;*************************************************************************
> ; Display setup
> ; Port D        bit             3       OE      Enable - clocks on neg
> transition
> ;                               2       RS      Register Select
> ;                                       command=0, data=1
> ;               bits    4-7     data    4 bits, high nibble first
> ;                                       ASCII format
> ;               RW grounded (write)
> ; Note that some commands take up to 1.6 msec for display to implement
> ; at a nominal display clock rate of 250 KHz
> ; Display initialize routine after power up
> ;
> ;************************************************************************
> ;
>
> START:
>           ldi r16,RAMEND      ;Init Stack Pointer (only needed for 2313)
>           out SPL,r16
>
>
>          ldi    temp,0b00000000 ; Start up with no outputs asserted.
>          out    PORTD,temp
>          ldi    temp, 0b00000000  ; None on portb either...
>          out    PORTB, temp
>
>          ldi     temp,0b11111111
>          out     DDRB,temp     ; PORTB = all outputs.
>          ldi    temp, 0b11101111
>          out    DDRD, temp     ; PORTD - RS, RW, and E.
>
> ldi     portDbase, 0b00000000  ; Make sure the shift light and
> ; rev limiter don't fire.
>
>          ldi temp, 0b00000111;
>          out TCCR0, temp
>                                   ;Load 1's into the Timer control
> register, to
>                                   ; enable the timer, and make it trigger
> on a
>                                   ; rising edge signal.
>                                   ; Now TCNT0 contains the value of the
> number of
>                                   ; double revolutions that happened
> since we last
>                                   ; reset the timer.
> ldi temp, 0b00001110;
>
> wdr ; Reset the watchdog.
> out WDTCR, temp ; Enable the watchdog timer.  This setting is about
> ; 1 second at 5V.
> wdr ; Reset the watchdog again...
>
>
>           ldi temp, 0b00100001    ; Start the counter at something
> vaguely appropriate
>           out TCNT0, temp
>
>
> ;
> ldi temp,50 ; Wait before turning on display.
> D1: ;
> rcall WAIT_2msec ;
>   rcall WAIT_2msec;
> rcall WAIT_2msec;
> dec temp
> brne D1
>
>          out portD, portDbase ;
>
> ldi temp,30 ; Wait at least 15msec after
> D2: ; powerup before writing
> rcall WAIT_2msec ; to display
>   rcall WAIT_2msec;
> rcall WAIT_2msec;
> dec temp
> brne D2
>
>
> wdr ; Reset the watchdog;
>
>          ldi    temp,0b00000000 ; Function set
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00111000  ; 2 line mode, 5x8 font
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>           rcall WAIT_2msec
>
>          ldi    temp,0b00000000 ; Display ON/OFF
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
> ;        ldi    temp, 0b00001111  ; display on, cursor on, blink on
>          ldi    temp, 0b00001100  ; display on, cursor off, blink off
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>          rcall WAIT_2msec
>
>          ldi    temp,0b00000000 ; Display Clear
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00000001  ; clear display
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>          rcall WAIT_2msec
>
>          ldi    temp,0b00000000 ; Entry mode set
>          or     temp, portDbase         ; assert the pins that need it.
>          out    PORTD,temp
>          ldi    temp, 0b00000111  ; increment mode, entire shift on
>          out    PORTB, temp
>          sbi    PORTD, EPIN       ; Enable transfer
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>          nop
>          nop                             ; Data write cycle must be
>  >1000usec
>        rcall WAIT_2msec;
>          cbi    PORTD, EPIN       ; clock transfer.
>        rcall WAIT_2msec;
>
>
> ;        ldi     temp,0b00001100 ; Display on, cursor/blink on
> ;        rcall   COMMAND_DISPLAY
>
>   ;       ldi temp, 0b
> ;
>
>
> ;*************************************************************************
> *******
> ;*************************************************************************
> *******
> ;***                               MAIN
> LOOP:                                 ***
> ;*************************************************************************
> *******
> ;*************************************************************************
> *******
> ENDLOOP:
>
>
>
>     wdr ; Reset the watchdog.
>
>     ldi   temp, 0          ; Reset counter
>     out   TCNT0, temp      ; Send 0 to counter
>
>                             ; Now wait until the counter increments, or
> we run out of patience...
>     ldi   temp, 0xFF        ;
>     ldi   temp_2, 0          ; So we can compare TCNT0 with 0.
> WAITLOOP1:
>     ldi   temp_1, 0xFF      ;
> WAITLOOP2:
>     in counter, TCNT0       ; Input the value of the counter
>     cp   temp_2, counter     ; Compare the counter to 0.
>     brlo  STARTTIMING       ; If the counter isn't 0, then we've got to
> start timing!
>     dec   temp_1            ; Decrement temp_1
>     brne  WAITLOOP2         ; Try again.
>     dec   temp              ; Decrease our outside loop
>     brne  WAITLOOP1         ; We