зачем столько GOTO
вот первое что увидел
Код: Выделить всё
title "PIC16f877 sample"
list p=16f877
#include <p16f877.inc>
f4l equ 0x20
f4h equ 0x21
f5 equ 0x22
f6l equ 0x23
f6m equ 0x24
f6h equ 0x25
k equ 0x26
org 00h
goto Start
Start
clrf f6h
clrf f6l
clrf f6m
movlw 0x8
movwf k
bcf STATUS,C
m1
rrf f5,1
btfss STATUS,C ;btfsc STATUS,C
goto m3 ;goto m2
;goto m3
;m2
movf f4l,0
addwf f6l,1
btfsc STATUS,C ;btfsc STATUS,C
;goto m4
;goto m5
;m5
incf f6m ;incf f6m
;m4
movf f4h,0
addwf f6m,1
btfsc STATUS,C ;btfss STATUS,C
;goto m3
;goto m6
;m6
incf f6h ;incf f6h
m3
rlf f4l,1
rlf f4h,1
decfsz k,1 ;decf k,1
;btfss STATUS,Z
goto m1
nop
end
Добавлено after 10 minutes 25 seconds:
увидел ошибку
сдвигаешь f4l и f4h влево и теряем старшие разряды
надо добавить f4hh
или другой алгоритм со сдвигом f6
Добавлено after 6 minutes 5 seconds:
Код: Выделить всё
title "PIC16f877 sample"
list p=16f877
#include <p16f877.inc>
f4l equ 0x20
f4m equ 0x21
f4h equ 0x22
f5 equ 0x23
f6l equ 0x24
f6m equ 0x25
f6h equ 0x26
k equ 0x27
org 00h
goto Start
Start
clrf f6l
clrf f6m
clrf f6h
clrf f4h
movlw 0x8
movwf k
bcf STATUS,C
m1
rrf f5
btfss STATUS,C
goto m3
movf f4l, W
addwf f6l
btfsc STATUS,C
incf f6m
movf f4m, W
addwf f6m
btfsc STATUS,C
incf f6h
movf f4h, W
addwf f6h
m3
rlf f4l
rlf f4m
rlf f4h
decfsz k
goto m1
nop
end
Добавлено after 1 hour 38 minutes 52 seconds:
Когда двигаем f6 то f5 двигаем в другую сторону
Код: Выделить всё
title "PIC16f877 sample"
list p=16f877
#include <p16f877.inc>
f4l equ 0x20
f4h equ 0x21
f5 equ 0x22
f6l equ 0x23
f6m equ 0x24
f6h equ 0x25
k equ 0x26
org 00h
goto Start
Start
clrf f6l
clrf f6m
clrf f6h
movlw 0x8
movwf k
bcf STATUS,C
m1
rlf f5
btfss STATUS,C
goto m3
movf f4l, W
addwf f6l
btfsc STATUS,C
incf f6m
movf f4h, W
addwf f6m
btfsc STATUS,C
incf f6h
m3
rlf f6l
rlf f6m
rlf f6h
decfsz k
goto m1
nop
end