Advertisement
Guest User

Untitled

a guest
Jul 10th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 0.87 KB | None | 0 0
  1. SPIslave:
  2.     incf    cnt, f
  3.     btfsc   status, z
  4.     incf    cnt_h, f
  5. ; skip    
  6.     movf    cnt_h, w
  7.     xorlw   0x00
  8.     btfss   status, z
  9.     goto    spiexit
  10.     movf    cnt, w
  11.     xorlw   0x5
  12.     btfsc   status, z    
  13.     bsf     flag, 0
  14.  
  15. ;check skip
  16.     btfss   flag, 0
  17.     goto    spiexit
  18.    
  19.     incf    cnt_byte, f
  20. ; overflow check
  21.     MOVF    cnt_byte, W
  22.     XORLW   0x6A ; .106
  23.     BTFSs   STATUS, Z
  24.     goto    temp1
  25.     bcf     PIR1, SSPIF
  26.     GOTO    sendd
  27. temp1:
  28. ; simply counter    
  29. ;    bcf     PIR1, SSPIF
  30. ;    retfie    
  31. ;
  32.     movf    SSPBUF, w    
  33.     movwf   INDF
  34.     INCF    FSR, f
  35. ; additional address
  36.     MOVF    FSR, W
  37.     XORLW   0x80
  38.     BTFSS   STATUS, Z
  39.     GOTO    NORMAL_OPERATION
  40.     MOVLW   0xA0
  41.     MOVWF   FSR
  42.     NORMAL_OPERATION:
  43. ;
  44.     decfsz  x5
  45.     goto    $+2
  46.     call    SPIReset
  47. ;
  48. spiexit:
  49.     bcf     PIR1, SSPIF
  50.     ;decfsz cnt, f
  51.     ;retfie
  52.     ;else
  53.     ;goto    send    
  54.     retfie
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement