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
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.
Hi Broeker,
Thanks for reply!
Could you please tell me exactly what I need to do as I am not getting your point? In case if you need source code or any other info please let me know.
as I am not getting your point?
Well, I'll be blunt then. The reason for that behaviour is explained in your microcontroller's data sheet. So go and read that. I won't deprive you of the learning experience of finding out the details for yourself.