Köpte en PICkit2 igår och sitter nu och grunnar på hur nedan angiven labbkod fungerar. Önskar hjälp med de rader där jag angivit "???".
Tack på förhand /Magnus
cblock 0x20
Delay1 ; Assign an address to label Delay1
Delay2
Display ; define a variable to hold the diplay
endc
org 0
Start:
bsf STATUS,RP0 ; val av rigister sida 1
clrf TRISC ; gör all IO PortC till output
bcf STATUS,RP0 ; åter till register sida 0
movlw 0x08 ; ??? varför just 8
movwf Display ; ??? stopp in 8 i "display"
MainLoop:
movf Display,w ; kopierar "display" till LED dioderna ??? Display,w
movwf PORTC ;
OndelayLoop:
decfsz Delay1,f ; Waste time.
goto OndelayLoop ; The Inner loop takes 3 instructions per loop * 256 loopss = 768 instructions
decfsz Delay2,f ; The outer loop takes and additional 3 instructions per lap * 256 loops
goto OndelayLoop ; (768+3) * 256 = 197376 instructions / 1M instructions per second = 0.197 sec.
; call it a two-tenths of a second.
bcf STATUS,C ; se till att "carry bit" är tömd.
rrf Display,f ; ???
btfsc STATUS,C ; Roterade biten i "carry"? ???
bsf Display,3 ; Ja, lägg den i bit 3. ???
goto MainLoop
end