Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LIST p=18f4520
- #include<p18f4520.inc>
- CONFIG OSC=INTIO67
- CONFIG WDT=OFF
- org 0x00
- initial:
- movlf macro l, fr ;move literal to file register
- movlw l
- movff WREG, fr
- endm
- addfff macro f1, f2, f_res ;add f1, f2 and store result to f_res
- movff f1, WREG
- addwf f2, 0, 1
- movff WREG, f_res
- endm
- cngpcl macro v
- movlw v
- movwf PCL
- endm
- start:
- movlf 0x00, 0x10 ;F0 = 0
- movlf 0x01, 0x11 ;F1 = 1
- movlf 0x09, 0x13 ;loop count = 9
- addfff 0x10, 0x11, 0x12
- rcall fib
- decfsz 0x13
- cngpcl 0x12
- fib:
- movff 0x11, 0x10
- movff 0x12, 0x11
- addfff 0x10, 0x11, 0x12
- return
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement