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

Assembly Vs C Programming

Hi,

I am using the AT89C5131A MCU. I have an issue related to the HEX code generated by keil.
Actually I was testing the output level(1 or 0) from each 4 ports using a simple HEX code.

IF I write an assembly code and generate its equivalent HEX code ( purpose - as stated above) and burn it to MCU then it works as expected.
But if I write same logic in keil(C program) then use the HEX code generated by it and burn it to MCU then is also works as expected for PORT 1 and PORT 3 only.
There are some fluctuations in PORT 0 and PORT 2 if I use the HEX code generated by Keil(c program) but with the Assembly's HEX code, all ports works fine.
I have checked all settings in Keil, all are correct.

Could anyone please tell me the solution for same.

Thanks in advance!
Mohit

Parents
  • I have checked all settings in Keil, all are correct.

    No, they're not. You've mis-configured one extremely crucial setting. And your hardware is slightly flawed, too.

    To find out what's wrong, I invite you to go back to the chip's data sheet and look up what functions P0 and P2 might have, but P1 and P3 don't, and how those might affect your observed behaviour.

Reply
  • I have checked all settings in Keil, all are correct.

    No, they're not. You've mis-configured one extremely crucial setting. And your hardware is slightly flawed, too.

    To find out what's wrong, I invite you to go back to the chip's data sheet and look up what functions P0 and P2 might have, but P1 and P3 don't, and how those might affect your observed behaviour.

Children