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

help with simple at89c52 c i/o program

Hi guys, im new to c in keil and i cant figure out the problem with this sooo simple program. When i write this on at89c52 it doesnt work but same program when programmed in assembly works perfectly.

Im using keil uvision3. Just trying to give output to 4 ports but after writing all ports give high output. Is this something with the header file im using? Should i use regx52.h?

here is the code
#include <at89x52.h>

sbit MYBIT = P1^0;
sbit MYBIT1 = P1^1;
sbit MYBIT2 = P1^2;
sbit MYBIT3 = P1^3;

void main (void)
{ MYBIT=1; MYBIT1=0; MYBIT2=1; MYBIT3=0;

}

0