Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/07/03 20:02
Read: times


 
#56283 - RE: Atmel 89C55WD cannot read with MOVC
Responding to: ???'s previous message
Oleg,

Below is the code failing to access code space. Lines 37 and 38 prints nothing, but line 45 and 46 prints proper values.
stmt level    source

   1          #ifndef PC_MODE
   2          #pragma CODE DEBUG SYMBOLS LARGE ROM(LARGE) NOLISTINCLUDE OPTIMIZE(0,SPEED)  
   3          #endif
   4          
   5          #include "sysconf.h"
   6          #include "8255.h"
   7          #include "lcd.h"
   8          #include <string.h>
   9          
  10          #ifndef PC_MODE
  11          
  12          
  13          xdata char msg1[]="abc";
  14          xdata char msg2[]="def";
  15          
  16          
  17          void main()
  18          {
  19   1         bool temp;
  20   1         data unsigned char xdata *p;
  21   1      
  22   1      /*
                 data char same[8];
                 data char diff[8];
              
                 code volatile unsigned char cc=0x55;
                 data volatile unsigned char dd;
                 xdata volatile unsigned char xx;
              */
  30   1         init_8255();
  31   1      //   PB = 0x55;
  32   1      
  33   1         init_lcd();
  34   1         lcd_open_backlight();
  35   1         lcd_cursor_on();
  36   1      
  37   1         lcd_print(10, 0, msg1);
  38   1         lcd_print(10, 1, msg2);
  39   1      
  40   1         for (temp = state_active_pin; state_active_pin == temp; );
  41   1      
  42   1         msg1[0]='x';msg1[1]='1';msg1[2]='2';msg1[3]=0;
  43   1         msg2[0]='x';msg2[1]='8';msg2[2]='7';msg2[3]=0;
  44   1      
  45   1         lcd_print(0, 2, msg1);
  46   1         lcd_print(0, 3, msg2);
  47   1      
  48   1         lcd_print(0, 0, "test");
  49   1         while(1);
  50   1      }
  51          
  52          #endif
  53          
C51 COMPILER V3.20,  TEST                                                                  07/10/03  21:33:52  PAGE 2   

ASSEMBLY LISTING OF GENERATED OBJECT CODE


             ; FUNCTION main (BEGIN)
                                           ; SOURCE LINE # 17
                                           ; SOURCE LINE # 18
                                           ; SOURCE LINE # 30
0000 120000  E     LCALL   init_8255
                                           ; SOURCE LINE # 33
0003 120000  E     LCALL   init_lcd
                                           ; SOURCE LINE # 34
0006 120000  E     LCALL   lcd_open_backlight
                                           ; SOURCE LINE # 35
0009 120000  E     LCALL   lcd_cursor_on
                                           ; SOURCE LINE # 37
000C 7F0A          MOV     R7,#0AH
000E 7D00          MOV     R5,#00H
0010 7B02          MOV     R3,#02H
0012 7A00    R     MOV     R2,#HIGH msg1
0014 7900    R     MOV     R1,#LOW msg1
0016 120000  E     LCALL   _lcd_print
                                           ; SOURCE LINE # 38
0019 7F0A          MOV     R7,#0AH
001B 7D01          MOV     R5,#01H
001D 7B02          MOV     R3,#02H
001F 7A00    R     MOV     R2,#HIGH msg2
0021 7900    R     MOV     R1,#LOW msg2
0023 120000  E     LCALL   _lcd_print
                                           ; SOURCE LINE # 40
0026 900000        MOV     DPTR,#00H
0029 E0            MOVX    A,@DPTR
002A FF            MOV     R7,A
002B EF            MOV     A,R7
002C C4            SWAP    A
002D 13            RRC     A
002E 13            RRC     A
002F 13            RRC     A
0030 5401          ANL     A,#01H
0032 FF            MOV     R7,A
0033 EF            MOV     A,R7
0034 24FF          ADD     A,#0FFH
0036 9200    R     MOV     temp,C
0038         ?C0001:
0038 900000        MOV     DPTR,#00H
003B E0            MOVX    A,@DPTR
003C FF            MOV     R7,A
003D EF            MOV     A,R7
003E C4            SWAP    A
003F 13            RRC     A
0040 13            RRC     A
0041 13            RRC     A
0042 5401          ANL     A,#01H
0044 FF            MOV     R7,A
0045 A200    R     MOV     C,temp
0047 E4            CLR     A
0048 33            RLC     A
0049 FE            MOV     R6,A
004A EF            MOV     A,R7
004B 6E            XRL     A,R6
004C 60EA          JZ      ?C0001
004E         ?C0002:
                                           ; SOURCE LINE # 42
004E 900000  R     MOV     DPTR,#msg1
0051 7478          MOV     A,#078H
0053 F0            MOVX    @DPTR,A
0054 900000  R     MOV     DPTR,#msg1+01H
C51 COMPILER V3.20,  TEST                                                                  07/10/03  21:33:52  PAGE 3   

0057 7431          MOV     A,#031H
0059 F0            MOVX    @DPTR,A
005A 900000  R     MOV     DPTR,#msg1+02H
005D 7432          MOV     A,#032H
005F F0            MOVX    @DPTR,A
0060 900000  R     MOV     DPTR,#msg1+03H
0063 E4            CLR     A
0064 F0            MOVX    @DPTR,A
                                           ; SOURCE LINE # 43
0065 900000  R     MOV     DPTR,#msg2
0068 7478          MOV     A,#078H
006A F0            MOVX    @DPTR,A
006B 900000  R     MOV     DPTR,#msg2+01H
006E 7438          MOV     A,#038H
0070 F0            MOVX    @DPTR,A
0071 900000  R     MOV     DPTR,#msg2+02H
0074 7437          MOV     A,#037H
0076 F0            MOVX    @DPTR,A
0077 900000  R     MOV     DPTR,#msg2+03H
007A E4            CLR     A
007B F0            MOVX    @DPTR,A
                                           ; SOURCE LINE # 45
007C 7F00          MOV     R7,#00H
007E 7D02          MOV     R5,#02H
0080 7B02          MOV     R3,#02H
0082 7A00    R     MOV     R2,#HIGH msg1
0084 7900    R     MOV     R1,#LOW msg1
0086 120000  E     LCALL   _lcd_print
                                           ; SOURCE LINE # 46
0089 7F00          MOV     R7,#00H
008B 7D03          MOV     R5,#03H
008D 7B02          MOV     R3,#02H
008F 7A00    R     MOV     R2,#HIGH msg2
0091 7900    R     MOV     R1,#LOW msg2
0093 120000  E     LCALL   _lcd_print
                                           ; SOURCE LINE # 48
0096 7F00          MOV     R7,#00H
0098 7D00          MOV     R5,#00H
009A 7B05          MOV     R3,#05H
009C 7A00    R     MOV     R2,#HIGH ?SC_0
009E 7900    R     MOV     R1,#LOW ?SC_0
00A0 120000  E     LCALL   _lcd_print
00A3         ?C0003:
                                           ; SOURCE LINE # 49
00A3 80FE          SJMP    ?C0003
00A5         ?C0004:
                                           ; SOURCE LINE # 50
00A5         ?C0005:
00A5 22            RET     
             ; FUNCTION main (END)

I'm pretty sure that LCD proc is OK. I know that both lines produce quite similar code. The only difference is the msg1 and msg2 initialization performed by accessing code space.

I verified (using debugger) that XDATA is cleared first and then variables are initialized. Below is the initialization part of msg1:
; mark1
0094H        MOVC      A,@A+DPTR                               ;BR 1
0095H        INC       DPTR
0096H        XCH       A,R0
0097H        XCH       A,DPL(82H)
0099H        XCH       A,R0
009AH        XCH       A,R2
009BH        XCH       A,DPH(83H)
009DH        XCH       A,R2
009EH        MOVX      @DPTR,A
; mark2
009FH        INC       DPTR
00A0H        XCH       A,R0
00A1H        XCH       A,DPL(82H)
00A3H        XCH       A,R0
00A4H        XCH       A,R2
00A5H        XCH       A,DPH(83H)
00A7H        XCH       A,R2
00A8H        DJNZ      R7,0093H
00AAH        DJNZ      R6,0093H
00ACH        SJMP      006CH
00AEH        CLR       T1(0B5H)
00B0H        MOV       R7,#0FFH
00B2H        MOV       R6,#0FFH
00B4H        MOV       A,R7
00B5H        DEC       R7
00B6H        MOV       R4,06H
00B8H        JNZ       00BBH
00BAH        DEC       R6
00BBH        ORL       A,R4
00BCH        JNZ       00B4H


at mark1, DPTR=492 and
>d c:0x492
C:0492        61 62 63 00 44 80-0E 64 65 66 00 00 0A 0E    abc.D..def....
C:04A0  11 11 11 11 0E 00 0A 11-11 11 11 11 0E 00 0E 11  ................
C:04B0  10 10 10 11 0E 04 0F 10-10 0E 01 01 1E 0C 0E 0E  ................
C:04C0  11 10 17 11 0F 00 04 0E-04 04 04 04 0E 00 12 00  ................
>d msg1
X:800A                         -      00 00 00 00 00 00            ......
X:8010  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
X:8020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
X:8030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................


at mark2, dptr=800a and
>d msg1
X:800A                         -      61 00 00 00 00 00            a.....
X:8010  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
X:8020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
X:8030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................


However this code does not work at the target system when 89c55wd is used (which has 20K Flash) but works with 8952 (8K flash). I also dumped the head of the xdata (where msg1 resides) to the LCD and verified that it is not initialized.

Based on these I conclude that I cannot read from code space with 89c55wd.

hope it is clear...

List of 22 messages in thread
TopicAuthorDate
Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
   RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
   RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
   RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
      RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
         RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
            RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
               RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
                  RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
               RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
                  Lock bits            01/01/70 00:00      
   RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
      RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
         RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
            RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
               RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
                  RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
               RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
                  RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
                     RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
                     RE: Atmel 89C55WD cannot read with MOVC            01/01/70 00:00      
                        False assumption on substitution            01/01/70 00:00      

Back to Subject List