
Originally Posted by
paul borgmeier
For the first block of ASM, replace with
PORTA = $10
TRISABUF=$10
OPTION_REG=$37
You need to post the rest of your ASM code in order for us to see how to completely convert the second block (.i.e, where is your delay routine?)
Code:
FHI VAR BYTE
FLO VAR BYTE
COUNT1 VAR BYTE
TRISABUF VAR BYTE
TEMPS VAR BYTE
All the ASM code
Code:
Asm
;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTHORIZATION OF COUNTING
clrf TMR0 ; RAZ timer
bsf _trisabuf,3 ; RA4 in entry and RA3 in entry authorization counting
movf _trisabuf,W
tris PORTA
;;;;;;;;;;;;;;;;;;;;;;;;;;;; BASE TIME
movf _TEMPS,W
movwf _COUNT1
dxxx nop
decfsz _COUNT1
GoTo dxxx
nop
nop
Call delay
Call delay
Call delay
Call delay
Call delay
;;;;;;;;;;;;;;;;;;;;;;;;;;; STOP OF COUNTING
bcf _trisabuf,3 ;RA4 in entry and RA3 at Exit to block counting
movf _trisabuf,W
tris PORTA
;;;;;;;;;;;;;;;;;;;;;;;;;;; RECUPERATION OF THE METERS
calcul MOVF TMR0,W ;timer -> work
MOVWF _FHI ;work -> FHI 8 bits of weight strong counting
clrf _COUNT1 ;handing-over has zero meter
Toggle incf _COUNT1,F ;incrementation of the meter
bsf PORTA,3 ;RA3 a 1
bcf PORTA,3 ;RA3 a 0
movf TMR0,W ;reading of the timer
subwf _FHI,w ;it is looked at if the divider incremente the timer
btfsc STATUS,2 ;comparison
GoTo Toggle ;if the timer did not incremente one starts again
comf _COUNT1,F ;complement with the meter
incf _COUNT1,W ;incrementation of the meter
movwf _FLO ;work -> FLO 8 bits of weight weak counting
GoTo fin
;;;;;;;;;;;;;;;;;;;;;;;;;;; BASE TIME
delay movlw 197 ;1ms according to AN592
movwf _COUNT1
nop
GoTo $+1
GoTo $+1
dly GoTo $+1
decfsz _COUNT1
GoTo dly
Return
fin
EndAsm
Bookmarks