Microprocessor light-emitting diode tachometer of AZLK

10/16/2007 - 20:39

Replacement to a regular tachometer, displays a being shone column from 80 light-emitting diodes

Displays a being shone column on a scale of light-emitting diodes, the Description of all dashboard in which the tachometer described below is established works from KSZ on BONDS, to look in article the AZLK Dashboard .

The circuit works with contact system of ignition on BONDS. Whether will correctly work with other engines, I can not promise.

A microprocessor light-emitting diode tachometer of AZLK

The matter is that in an entrance chain there are no special elements for elimination of a tinkling sound of contacts, the tinkling sound is filtered programmno. The program considers that passed the forward front of an impulse if the high signal on an entrance keeps not less set time. This delay stole up a method scientific тыка. At reduction of a delay of the indication become overestimated because of calculation of fronts from a tinkling sound, at increase in a delay on big frequency there are admissions in calculation of regular impulses.

As a result the program which steadily works turned out and gives the evidences coinciding with indications of a tachometer from a priborka of RAR in дипазоне of 500-5500 rpm. But there is no guarantee that this circuit will work with other engines, or with other type of system of ignition since to prove the chosen size of a delay I cannot than, except the carried-out tests.

Light-emitting diodes are connected to exits of Out1-Out15 of type "an open collector". It allowed запитать diodes from 12В with consecutive inclusion on 4 diodes. Chips of MBI equalize a current (and thus brightness of a luminescence) at consecutive inclusion of several light-emitting diodes in an incomplete chain. Such inclusion also reduces a consumed current.

The tachometer is connected to standard conclusions of a plait of conducting for connection of a regular tachometer.

Range of measurement of 0-8000 rpm with a step of 100 rpm.

Insertion

It is possible to copy the text between lines - in a text editor, NOTEPAD will approach, and to save the file with the HEX expansion. Such file can be used for a microprocessor insertion.

-------------------
:020000040000FA
:10000000850186018B018101640083160030850023
:1000100001308600C730810083125F2014308D00CC
:1000200058208D0B1028542010308D000B1D1628E1
:100030000B118D0B16285F20542020203A201D28FC
:100040008C0120308E0005308D008B101630810021
:100050000B118B1C3328061C30288E0B33288C0A7E
:100060008B1020308E000B1D29288D0B26288C0C20
:100070008C1308005F200C080339013E8D008615A3
:100080004328502086118D0B41288C0C8C138C0C2E
:100090008C138C0A4C2858208C0B4B2854200800B9
:1000A00006150000061108008614000086100800DE
:1000B00086155020861150205020502008008611AF
:0C00C00050308D0050208D0B622808008D
:02400E00F13F80
:00000001FF
----------------------- 

Program

Further the initial text of the program for those who can and will conceive something to correct.

; tachometer
 list p=16F84A
 #include 
 __ config _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC

; Constants
bitSDI	equ	3
bitCLK	equ	2
bitLAT	equ	1
iniRPT equ 5
iniTMR equ d '022'; d '100'
iniDBL equ d '032'

; Variables
cntIMP	equ	0x0C	; counter of impulses
cntRPT	equ	0x0D	; counter of repetitions
cntDBL equ 0x0E; counter of time of a tinkling sound of contacts

; program
	org		0x000
	clrf	PORTA
	clrf	PORTB
	clrf	INTCON
	clrf	TMR0
	clrWDT

	bsf		STATUS, RP0
	movlw	b'00000000'; all bits of RA on a conclusion
	movwf	PORTA
	movlw	b '00000001'; RB0 on input, other bits of port on a conclusion
	movwf	PORTB		; we switch off tightening resistors,
	movlw b '11000111'	; TMR0 on an internal step with a predivider 256
	movwf		; interruptions are forbidden OPTION_REG, we will check tags
		bcf		STATUS, RP0

; prologue
; to include all scale

        call SendCLR
        movlw d '20'
        movwf cntRPT
loopPRE1
        call SendQRT
        decfsz cntRPT, f
        goto loopPRE1
        call SendLAT      
        ; to wait 1 with = for 16 tics (1 tic = 64К microsec = 65 ms)
        movlw d '16'
        movwf cntRPT
loopPRE2
        btfss	INTCON, T0IF
        goto loopPRE2
        bcf	INTCON, T0IF
        decfsz cntRPT, f
        goto loopPRE2  
        ; to switch off
        call SendCLR
        call SendLAT

; global cycle		
Main_loop
        call COUNT_IMP
        call SHOW_COUNT
        goto Main_loop

COUNT_IMP; measurement phase

	clrf	cntIMP	; we null the through counter
        movlw iniDBL
        movwf cntDBL; we initialize the counter of blocking of a tinkling sound
        movlw iniRPT
	movwf	cntRPT; cycle of calculation of impulses 
			    ; (5 times counting by the timer on 60мс)
	bcf	INTCON, INTF
ms300
	movlw	iniTMR; at 4Мгц and a predivider 1:256 
			    ; 1 tic of the timer of 256 microsec turns out
	movwf	TMR0; TMR0 should count from 22 
			    ; to 256 during 59,904 ms
	bcf	INTCON, T0IF
ms60					
	btfss	INTCON, INTF; if there was a front of an impulse of the sensor,
			    ; that we go on processing of counters
	goto	NoINCR	; the sensor is silent, we go to check the timer
DoINCR
        btfss PORTB, 0
        goto ClrINT; if RB0=0, we dump interruption
                            ; if RB0=1,
        decfsz cntDBL, f; we detain further actions
        goto NoINCR; before zeroing of the counter of a tinkling sound
     			    ; the delay for the period of a tinkling sound ended
        incf cntIMP, f; +1 in a schechik of impulses
ClrINT
        bcf	INTCON, INTF; dumped a flag of external interruption
        movlw iniDBL
        movwf cntDBL; we initialize the counter of blocking of a tinkling sound
NoINCR
        btfss	INTCON, T0IF; we repeat a small cycle,
	goto	ms60	; while TMR0 will not tell: will suffice!
	decfsz	cntRPT, f; counted 60 ms, it is necessary to repeat 5 times, 
	goto	ms300	; that an interval of counting turned out 0,3 seconds
        ; counted 300 ms
        rrf cntIMP, f; we halve the counted number of impulses
        bcf cntIMP, 7
        return

SHOW_COUNT; phase of indication of results of measurement
; занулить indicator bits
        call SendCLR
; conclusion of a nepony quartet of a scale
        movfw cntIMP
        andlw 3; a remainder of division on 4
        addlw 1; +1
        movwf cntRPT; in a schechik of repetitions
        bsf PORTB, bitSDI
        goto loopMOD+2; to enter into a cycle from counter check 
loopMOD
        call SendCLK
        bcf PORTB, bitSDI
        decfsz cntRPT, f
        goto loopMOD        
; conclusion of full quartets of a scale
        rrf cntIMP, f
        bcf cntIMP, 7
        rrf cntIMP, f
        bcf cntIMP, 7; integer division 
			      ; on 4 counters of impulses
        incf cntIMP, f; gives number of full quartets of a scale
        goto loopDIV+1; to enter into a cycle from counter check
loopDIV
        call SendQRT
        decfsz cntIMP, f
        goto loopDIV 
; switching on indication of new measurement
        call SendLAT 
	return

; subprogrammes

SendCLK; formation of a clock impulse of CLOCK
	bsf		PORTB, bitCLK	
	nop						
	bcf		PORTB, bitCLK
        return

SendLAT; conclusion of an impulse of a latch of LATCH
	bsf		PORTB, bitLAT
	nop
	bcf		PORTB, bitLAT
        return

SendQRT; conclusion of a full quartet
        bsf PORTB, bitSDI; for each full quartet we deduce 1000
        call SendCLK
        bcf PORTB, bitSDI
        call SendCLK
        call SendCLK
        call SendCLK
        return

SendCLR; to clear a scale
        bcf PORTB, bitSDI
        movlw d '80'
        movwf cntRPT
loopCLR
        call SendCLK
        decfsz cntRPT, f
        goto loopCLR
        return
		
	end

http://www.club.azlk.ru source

Microprocessor light-emitting diode tachometer of AZLK