I have ADuC847 (8051) microcontroller. You provided our partner with trial version of C51 compiler. If I select Small memory model, my unit works perfect. But if I select Large memory model, it works incorrect. Program size: data=12.0 xdata=93 code 924 As I discovered PLDXDATA affects my 'P0' port value and the program goes in unknown way. Here is the piece if code:
59: void OutputLED(unsigned char val) 60: { 61: P0 = ~val; C:0x037A EF MOV A,R7 C:0x037B F4 CPL A C:0x037C F580 MOV P0(0x80),A 62: } C:0x037E 22 RET // Then the following code runs: C:0x0309 7B00 MOV R3,#0x00 C:0x030B 7A00 MOV R2,#0x00 C:0x030D 7900 MOV R1,#0x00 C:0x030F C003 PUSH 0x03 C:0x0311 C002 PUSH 0x02 C:0x0313 C001 PUSH 0x01 C:0x0315 90001F MOV DPTR,#0x001F C:0x0318 12006D LCALL C?PLDXDATA(C:006D) C:0x031B 120096 LCALL C?PSTPTR(C:0096) // PLDXDATA has the following ASM code: C?PLDXDATA: C:0x006D E0 MOVX A,@DPTR C:0x006E FB MOV R3,A C:0x006F A3 INC DPTR C:0x0070 E0 MOVX A,@DPTR C:0x0071 FA MOV R2,A C:0x0072 A3 INC DPTR C:0x0073 E0 MOVX A,@DPTR C:0x0074 F9 MOV R1,A C:0x0075 22 RET
// BUT command "C:0x006D E0 MOVX A,@DPTR" // affects my P0 state. Before it was EF and afterwards it changes to FF. Could you give me a hand with it?