Tachometer schematics
Tachometer source code
;=====Tachometer ======27/03/06==
; iic lcd driver: PCF2113 E
; internal clock
; int osc 4.000 MHz - 1us pe instructiune
; Program realizat de Ing. Bergthaller Iulian-Alexandru
;------------------------------------------------------------
list p=12f629 ;controller
#include
__CONFIG _MCLRE_OFF & _CPD_OFF &_CP_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT & _BODEN_OFF
radix dec
errorlevel -302 ; suppress message 302 from list file
; cpu init
cblock 0x20 ; Beginn General Purpose-Register
count1
count2
count3
count4
transo
buff
LO_TEMP
HI_TEMP
TEMP3
TEMP2
TEMP1
blank
contor
;--------------------------
endc
#DEFINE setu GPIO, GP3
#DEFINE sclk GPIO, GP1
#DEFINE sdta GPIO, GP0
org 0x00
goto init
org 0x04
;
init bcf STATUS,RP0 ; Bank 0
clrf GPIO ; aus!
movlw 0x07
movwf CMCON ; alle Pins digital (nicht Comp)
bcf INTCON,GIE
bsf STATUS,RP0 ; Bank 1
call 0x3FF
movwf OSCCAL ; 4-MHz-Kalibrierung
movlw 0xF8
movwf TRISIO
bcf STATUS,RP0 ; Bank 0
movlw 0x01
movwf contor
call lcd_ini
;***************************************************
loop
;* Lcd data subroutine *
call iict
movlw 0x74
call act
movlw 0x40 ; Co=0, RS=1, set instruction register for next data bytes
movlw 0xD2 ; R
movlw 0xD0 ; P
movlw 0xCD ; M
movlw 0xBA ; :
call iicp
call pause
call set_timer
movf contor,W
call halta
bcf T1CON,0
conversie
movf TMR1L,W ; LO -> LO_TEMP
movwf LO_TEMP
movf TMR1H,W ; HI -> HI_TEMP
movwf HI_TEMP
bcf blank,0 ; invalidate flag
movlw 0x27 ; verifica div. cu 10000
movwf TEMP3
movlw 0x10
movwf TEMP2
call convb
movlw 0x03 ; verifica div. cu 1000
movlw 0xE8
clrf TEMP3 ; verifica div. cu 100
movlw 0x64
clrf TEMP3 ; verifica div. cu 10
movlw 0x0A
clrf TEMP3 ; verifica div. cu 1
bsf blank,0 ; remove blank checker in case of zero
call lcd_home
;*****************************************
btfss setu
call timp
homa goto loop
convb
clrf TEMP1 ; clear counter
conv_high
movf TEMP3,W
subwf HI_TEMP,W ; TEST: HI_TEMP-TEMP3 >0 ?
btfss STATUS,C
goto conv_end ; resultat negativ, exit
btfss STATUS,Z ; TEST: HI_TEMP-TEMP3 = 0 ?
goto conv_low ; test zero, goto if result > 0
movf TEMP2,W ; Precondition: HI-TEST is zero
subwf LO_TEMP,W ; TEST: LO_TEMP-TEMP2 > 0 ?
btfss...
fred1144