EEVblog Electronics Community Forum
Electronics => Microcontrollers => Topic started by: TheInfernoMan on January 15, 2017, 02:08:12 pm
-
Hello,
I have a problem running my code (for a school project) on my little PCB with a AT89C2051.
I tested the code on a AT89S52 and on the AT89S52 it works like a charm (on P3, because of ISP) ^-^
But when I try the code on my AT89C2051 (yes I changed the target (for the addresses)) it dont work. |O
It goes to "start" but after that, the code did not run :/ :wtf:
Did someone have an idea why it is so? I think about some incompatibility...
Is there a way to optimize the code (it is attached with german commentary) ?
Thanks in advance :)
-
I think you'll need to change:
fehlgeschlagen:
MOV R6, 8d
MOV P1, 0ffh
to:
fehlgeschlagen:
MOV R6, #8d ; missing '#'?
MOV P1, #0ffh ; missing '#'?
-
Oh you are right :palm: :O I try it
-
No sorry, it is still not working |O
-
No sorry, it is still not working |O
Check that you have 'MOV R6, #8d' not 'MOV R6, #8dh' (I incorrectly made the constant hexadecimal 0x8d when it should had been decimal 8 in my original reply, but it is changed now).
-
No in my code, it is correct. But still thanks for this idea ;)
-
One more thing. Are there push buttons connected to P1.0 to P1.3? Do you have pull-ups in P1.0 and P1.1? From the data sheet: "The Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7 provide internal pull-ups. P1.0 and P1.1 require external pull-ups."
-
Yes it is so, the push buttons are at P1.0-P1.3 with pullups at P1.0 and P1.1