;-----------------------------------------------------------------------;
; BINCNT.ASM Counts in binary on LEDs ( RB0 - RB4 ) ;
;-----------------------------------------------------------------------;
;-----------------------------------------------------------------------;
; The next 6 lines are directions to the assembler ;
;-----------------------------------------------------------------------;
LIST P=16F84 ; tells which processor is used
INCLUDE "p16f84.inc" ; defines various registers etc. Look it over.
ERRORLEVEL -224 ; supress annoying message because of tris
__CONFIG _PWRTE_ON & _LP_OSC & _WDT_OFF ; configuration switches
ORG 0 ; start a program memory location zero
;-----------------------------------------------------------------------;
; First we set up all bits of PORT A and B as outputs ;
; and set bits in the OPTION register concerning TMR0 ;
;-----------------------------------------------------------------------;
movlw B'00000000' ; all bits low in W
tris PORTA ; contents of W copied to PORT A ...
tris PORTB ; and PORT B
movlw B'00000100' ; pull-ups active
; prescalar assigned to TMR0 and set 1:32
option ; rolls over each second
;-----------------------------------------------------------------------;
; This is the main program ;
;-----------------------------------------------------------------------;
clrf PORTB ; start with zero
loop:
incf PORTB, f ; add 1 to port B
btfss INTCON, T0IF ; wait on T0IF to be set
goto $ -1
bcf INTCON, T0IF ; clear the interrupt flag
goto loop
end ; end of program
Как това до го превърна в .hex файл?
