|
|
View previous topic :: View next topic |
Author |
Message |
Alex Guest
|
arrays in two banks pic18 |
Posted: Fri May 29, 2009 5:38 am |
|
|
i have 2 arrays 120 bytes each
i was having difficulties while thrying to copy array1 to array2
when i've looked in .sym file i've found that compiler puts first array in bank0 at 057-0CE and second at 0CF-146 - in bank0 and bank1
and the code that generated does not switches banks
Code: |
.................... void arrays()
.................... {
.................... int8 j;
.................... for (j=0; j<120; j++)
*
053C: MOVLB 1
053E: CLRF xE9
0540: MOVF xE9,W
0542: SUBLW 77
0544: BNC 0590
.................... {
.................... array2[j] = array1[j];
0546: CLRF 03
0548: MOVF xE9,W
054A: ADDLW CF
054C: MOVWF 01
054E: MOVLW 00
0550: ADDWFC 03,F
0552: MOVFF 03,1EB
0556: CLRF 03
0558: MOVF xE9,W
055A: ADDLW 57
055C: MOVWF FE9
055E: MOVLW 00
0560: ADDWFC 03,W
0562: MOVWF FEA
0564: MOVFF FEF,1EC
0568: MOVFF 1EB,FEA
056C: MOVFF 01,FE9
0570: MOVFF 1EC,FEF
.................... if (array2[j]==0x31)
0574: CLRF 03
0576: MOVF xE9,W
0578: ADDLW CF
057A: MOVWF FE9
057C: MOVLW 00
057E: ADDWFC 03,W
0580: MOVWF FEA
0582: MOVF FEF,W
0584: SUBLW 31
0586: BNZ 058C
.................... output_toggle(pin_c1);
0588: BCF F94.1
058A: BTG F8B.1
.................... }
058C: INCF xE9,F
058E: BRA 0540
.................... }
0590: MOVLB 0
0592: GOTO 059A (RETURN)
|
did any one encountered this before?
i'm using pic18f45k20
compiler version 4.074
Alex. |
|
|
Ttelmah Guest
|
|
Posted: Fri May 29, 2009 7:10 am |
|
|
It doesn't have to bank switch.
It is using the indirect addressing registers.
Presumably you are aware, if you just want to copy the array contents, that a memcpy, will do this more efficiently...
What you show is legitimate. If it doesn't work, look elsewhere.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|