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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/21/01 16:12
Read: times


 
#12702 - Program jumps not as expected ??
Hi...

I'm new to the 8051 world. One month ago I started to write a C program for my project using the development tool from keil. The program works fine in the simulator. But after loading it into RAM of the board and debug using Montor-51,it behaves very strange. When a specific function is called, the program will jump to the mid part of that function and execute from there. So the result is wrong.

Here are some information from disassembly (when that function is called)

address instruction
==========================
C:0x0003 MOV DPTR,#0x0036
C:0x0006 MOV A,R3
C:0x0007 MOVX @DPTR,A


Register
r0 0x00
r1 0x16
r2 0x00
r3 0x01
r4 0x00
r5 0x05
r6 0x00
r7 0x1c

SYS
a 0x00
b 0x01
sp 0x25
dptr 0x114c
PC 0x0003

After the instruction in Cx0003 is executed, it will jump to the following address (C:0x0373) and start there

C:0x0373 mov A,#0x00
C:0x0375 movx @DPTR,A
C:0x0379 INC DPTR

Register
r0 0x00
r1 0x16
r2 0x00
r3 0x01
r4 0x00
r5 0x05
r6 0x00
r7 0x1c

SYS

a 0x00
b 0x01
sp 0x25
dptr 0x114c
PC 0x0373

The following are my project's configuration
Chip : Dallas DS80C320
Board: Keil MCB520 evaluation board
Memory Model : Large
Code ROM size : compact
C COmpiler : Keil C51 V6.12
Assembler : Keil A51 V6.12
Linker : Keil BL51 V4.13
the starting address of that function : C:0x0003

Except listed, I didn't change any settings of the compiler and the micro Vision2.I don't know what's wrong with my program. Could anyone please help ?
Thanks in advance.

List of 4 messages in thread
TopicAuthorDate
Program jumps not as expected ??            01/01/70 00:00      
RE: Program jumps not as expected ??            01/01/70 00:00      
RE: Program jumps not as expected ??            01/01/70 00:00      
RE: Program jumps not as expected ??            01/01/70 00:00      

Back to Subject List