PROBLEM WITH THE C CODE

#include<reg51.h>

sfr port= 0x80;
void main()
{ port=~port;
}

This code was successfully compiled...but yu expect the port pins are complemented only once..But what i experiened when used with a simulator software, was the port pins get complemented for infinite times( somthing like the 'port=~port;' instruction was put in a while(1) loop..)

What could be the wrong?

Parents
  • but yu expect the port pins are complemented only once

    No. We don't expect that. You do.

    We have read enough of the documentation, particularly the tutorials, to know that falling through the end of main() is not typically something one should do in an embedded C program if one doesn't want unexpected things to happen.

    What could be the wrong?

    Your expectations are.

Reply
  • but yu expect the port pins are complemented only once

    No. We don't expect that. You do.

    We have read enough of the documentation, particularly the tutorials, to know that falling through the end of main() is not typically something one should do in an embedded C program if one doesn't want unexpected things to happen.

    What could be the wrong?

    Your expectations are.

Children
More questions in this forum