Home > Back-end >  How to single chip microcomputer KouFu value.
How to single chip microcomputer KouFu value.

Time:10-23

Want to 0 x01, this number is assigned to MCU P1 ^ 2, P1 ^ 3, P1 ^ 4, four port P1 ^ 5, how to implement in C? Seek guidance,,
(in addition to 0=P1 ^ 2, 0=P1 ^ 3 ^ P1, 0=4, 1=P1 ^ 5) this approach

CodePudding user response:

You mean in c + + builder to SCM assignment or the inside of the single chip microcomputer program directly?

SCM:

P1=0 XFF;//8 bits assignment directly, so, of course, maybe you do not want a assignment 8 ports, then read - & gt; Change - & gt; Write. So only change you want to change the port.

CodePudding user response:

Shift then temp=0 x01 direct assignment; P1=temp<2; Can be

CodePudding user response:

You are using is 51 microcontroller
Uchar temp=0 x01;
For (char I=0; i<4. I++)
{
Temp=_crol_ (temp, 1);
Delay (100);
P1=temp;
}

CodePudding user response:

P1=0 x3b;//0011, 1100=0 x3b
  • Related