We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, there: I had my project builded with 0 error as well as 0 warning. Then I tried to simulate it with dScope. When I push step by step to trace my flow, I found the flow will jump flying away to elsewhere, returning back after finishing some instruction. I downloaded it to my 8051, and it can't work. I tried to change optomize level, it will have some different result, but still the problem it's there were. Would someone please help me to solve this problem. Thanks a lot. Morris
I had my project builded with 0 error as well as 0 warning. Then I tried to simulate it with dScope. When I push step by step to trace my flow, I found the flow will jump flying away to elsewhere, returning back after finishing some instruction. I can think of 47 reasons, so if youy want an answer, you need to be more specific. e.g. C or assembler e.g. any ISRs coded e.g. any interrupts enabled e.g. what is the instruction where this happens etc more words, does not make you appear stupid, it makes a relvant answer possible Erik on second thought, its 49 resasons
Dear Erik, thanks for you reply, and I try to list it as blow :P : 1.) I used C and my KeilC is V7.5 2.) I opened 6 interrupts for my system program : T0 : System Time Calculator T2 : System task scheduler timer, and I only implemented 2 task , that says, I/O port triggering and time.second, time.minutes for my system program. T1 : Baud rate generator Sr : Serial Port 3.) My CPU is 8052 based, and it has 1024 byte on-chip RAM. 4.) I used Large memory model. 5.) In my previous version, the system program worked fine, but after my adding more and more module, this strange thing happened. 6.) According to disassembly code, C:0x6191 12000E LCALL LatchBuffer_Clear(C:000E) , it should jump to C:000E, but when I traced into it, it jumped to and executed these three executions C:0x001B F51C MOV 0x1C,A C:0x001D F51D MOV 0x1D,AC573_Init(C:692B) C:0x001F 22 RET devIIC_Initial(C:4E03) then returned back to C:000E. 7.) Program Size: data=72.3 xdata=230 code=26927. 8.) Main system flow
PowerOn(); Init_CPU(); Init_SystemDriver(); SystemRun(); // Enable system scheduler
What optimisation level are you using? Could this be common entry/exit merging, or something?
"5.) In my previous version, the system program worked fine, but after my adding more and more module, this strange thing happened." So the standard procedure would be to go back to that version, rebuild it, and check if it still works. If it does, there's something wrong with your new modules; If it doesn't, you've broken the tools!
"If it does, there's something wrong with your new modules" So go back to the working version, and carefully add modules one at a time; Check, Test, & Inspect thoroughly at each stage. Thus you can narrow down precisely where the error was introduced. If you've added so much code that you're now on the edge of overflowing your code space, that could possibly be a cause...
"6.) According to disassembly code, C:0x6191 12000E LCALL LatchBuffer_Clear(C:000E)" Note that CODE address C:000E is within the TF0 interrupt vector... Can you use the debugger to check the interrupt flags? Or, put "dummy" handlers in for all interrupts that will enable you to tell when "unexpected" interrupts have occurred...
Dear Andy, thanks for your help: I tried to down-level the optimization level, and the jump flying issue was gone as well as the working well of simulation. But come with another issue was the simulation worked fine and can see the output form serial windows, I can't see any output by downloading code to CPU ? I really appreciate your all support. Morris
Dear A.W, thanks for your help: I tried to down-level the optimization level, and the jump flying issue was gone as well as the working well of simulation. By the way, I also your instruction to put the interrupt dump in my project, and nothing was jump there. But come with another issue was the simulation worked fine and can see the output form serial windows, I can't see any output by downloading code to CPU ? I really appreciate your all support. Morris