PIC tachometer up to 9999 RPM
Sep 5, 2009 Projects
Another early project of mine I build for yo5bhg.
It’s a simple tachometer with PIC microcontroller which can count up to 9999 RPM.
This is the code in the main.asm files (other files will be added when I have time to rewrite the comment to English).
;------------------------------------------------------------------------- ;Author : Istvan Vanyi, yo5ofj ;Filename : main.asm ;PIC tachometer up to 9999 RPM ;------------------------------------------------------------------------- include "config.inc" ;some include files include "p16f628.inc" org 0x0c8 include "display.inc" include "delay.inc" org 0x00 ;start the program goto start ;************************************************************** org 0x04 ;interrupt vector goto interrupt interrupt: include "intsvr.inc" ;************************************************************** ;************************************************************** start: init: clrf r0 ;clear registers clrf r1 clrf r2 clrf d1 clrf d2 clrf d3 clrf d4 clrf porta ;PORTA for input/output movlw 0x07 movwf cmcon bank1 movlw b'00000000' ;all PORTB pins output movwf trisb movlw b'00110000' ;ra0-ra3 output for cathode, ra4 input for the counter movwf trisa movlw b'00100000' ;tmr0 divide rate 1:1 movwf option_reg bank0 movlw b'00110001' ;set tmr1, intrerrupt every 500 msec movwf t1con movlw b'00001011' movwf tmr1h movlw b'11011100' movwf tmr1l clrf pir1 bank1 movlw .1 movwf pie1 ;start temporizattion bank0 movlw b'11100000' movwf intcon ;activate interrupting ;************************************************************** ;main procedure ;************************************************************** main: call display goto main ;endless loop ;************************************************************** end |
Related posts:




Leave a Reply