This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Assembler - Crash

Hi,

I hope someone can help me: I have a C-file and a ".a51"-Assembler-file in my project. I'm working with the "80c51c" from Infineon. My problem is this:

ACC = 30;
a_func();      // accesses the R0-register


a_func() is a pure-Assembler-function in the ".a51"-file. When I trie to access to Registers within the C-file and the assembler-file simultaneously, the Debugger crashes.

What's the problem?

  • My problem is this:

    ACC = 30;
    

    That is indeed a problem, but not the one you think you have. This line of code expresses your belief that there were something useful to be achieved by accesing the primary CPU registers, e.g. ACC, in C code. Well, sorry to burst your bubble, but that belief is utterly wrong. In C source code, all of the primary registers (ACC, R0..R7, SP, DPTR, etc.) belong to the C compiler. Trying to use them yourself is just bound to fail in all kinds of painful ways.

  • Hi.

    What have you got ACC defined as? Is it a local variable or are you really trying to access the CPU ACCumulator? Also you should say in what way the debugger crashes. Is it really crashing or dsimply doing something you do not expect to happen? Even if you were attempting to us the ACCumulator, it would be unexpected for the debugger itself to crash.

    Answer these and you might be on the right step for a useful response.