Home > other >  How to read the AT89C51 p1 mouth of high and low level so as to control the LED light.
How to read the AT89C51 p1 mouth of high and low level so as to control the LED light.

Time:09-16

How to read the AT89C51 p1 mouth of high and low level so as to control the LED light. (in assembly language)

CodePudding user response:

Control the led output
Read as input
//output low level
Mov P1.0, 0
//output high level
Mov P1.0, 1
Destroy the light of the led to see how you pick, current-limiting resistance to high level is 0.

CodePudding user response:

reference 1st floor cg5210 response:
control led output
Read as input
//output low level
Mov P1.0, 0
//output high level
Mov P1.0, 1
Destroy the light of the led to see how you pick, current-limiting resistance to high level is 0.
excuse me, would be grounded p1.0 port, low level of how to read it

CodePudding user response:

51 single chip microcomputer "read pin" operation in the teaching material has introduced: CPU to execute commands "MOV" class, "read pin" is for operation, must first before reading pin on the latch to write "1", make the field effect tube T2 cutoff, the corresponding code is as follows:
MOV P1, FFH # 0; Latch to write "1"
MOV A, P1; Reading a P1 pin state

If you just want to read the P1.0 pin, the code is as follows:
SETB P1.0
MOV C, P1.0

CodePudding user response:

# include
# define uchar unsigned char
Uchar TAB {}={oxe7 oxdb, oxbd, ox7e}
Void delay []
{
Uchar I, j;
for(i=0; i<255; I++)
for(j=0; j<255; J++)
}
Void main
{uchar k;
While (1)
{the for (ck=0; K<6; K++)
{p1=TAB [k]
delay();
}
}
}
  • Related