Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. LIST p=18f4520
  2. #include<p18f4520.inc>
  3. CONFIG OSC=INTIO67
  4. CONFIG WDT=OFF
  5. org 0x00
  6.  
  7. initial:
  8. movlf macro l, fr ;move literal to file register
  9. movlw l
  10. movff WREG, fr
  11. endm
  12.  
  13. addfff macro f1, f2, f_res ;add f1, f2 and store result to f_res
  14. movff f1, WREG
  15. addwf f2, 0, 1
  16. movff WREG, f_res
  17. endm
  18.  
  19. cngpcl macro v
  20. movlw v
  21. movwf PCL
  22. endm
  23.  
  24. start:
  25. movlf 0x00, 0x10 ;F0 = 0
  26. movlf 0x01, 0x11 ;F1 = 1
  27. movlf 0x09, 0x13 ;loop count = 9
  28. addfff 0x10, 0x11, 0x12
  29. rcall fib
  30. decfsz 0x13
  31. cngpcl 0x12
  32.  
  33. fib:
  34. movff 0x11, 0x10
  35. movff 0x12, 0x11
  36. addfff 0x10, 0x11, 0x12
  37. return
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement