In my LED matrix I implemented a display double buffer & need to copy the working buffer to display buffer.I wrote a code but it takes lots of time closer to 650uS
Note: The working buffer is in Bank0 & the Display buffer in Bank 1.
Note: The working buffer is in Bank0 & the Display buffer in Bank 1.
Code:
;physical placement of working buffer
;D2 D4 D6 D8 D10 D12 D14 D16 D18 D20 D22 D24 D26 D28 D30 D32 D34 D36 D38 D40 D42 D44 D46 D48 D50 D52 D54 D56 D58 D60 D62 D64
;D1 D3 D5 D7 D9 D11 D13 D15 D17 D19 D21 D23 D25 D27 D29 D31 D33 D35 D37 D39 D41 D43 D45 D47 D49 D51 D53 D55 D57 D59 D61 D63
cblock 30h ; Working buffer 64 bytes
D1,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12,D13,D14,D15,D16 ;30-3Fh
D17,D18,D19,D20,D21,D22,D23,D24,D25,D26,D27,D28,D29,D30,D31,D32 ;32 40-4F
D33,D34,D35,D36,D37,D38,D39,D40,D41,D42,D43,D44,D45,D46,D47,D48 ;48 50-5F
D49,D50,D51,D52,D53,D54,D55,D56,D57,D58 ;58 60-69h
endc
cblock 0D0h ; Display buffer 64 bytes
; 64 bytes RAM
endc
Copy_Buffer movlw 30h
movwf FSR
movlw .32
movwf Counter
;
Copy_Loop movf INDF,W ; B0 INDF ; ;1
movwf Temp ; ;2
movlw .48 ; ;3
addwf FSR,F ; B1 INDF ; ;4
movf Temp,W ; ;5
movwf INDF ; ;6
;
movlw .47 ;7
subwf FSR,F ; B0 INDF + 1 ;8
movf INDF,W ;9
movwf Temp ;10
movlw .48 ;11
addwf FSR,F ; B1 INDF ;12
movf Temp,W ;13
movwf INDF ;14
;
movlw .48 ;15
subwf FSR,F ; back to B0 ;16
decfsz Counter,F ;17
goto Copy_Loop ;19
return