Home > other >  51 single chip microcomputer 74 ls164
51 single chip microcomputer 74 ls164

Time:09-24



Code:

# include
# include
# define uchar unsigned char
# define uint unsigned int
Void DelayMS (uint ms)
{
Uchar I;
While (ms -) for (I=0; I<120; i++);
}
//???
Void main ()
{
Uchar c=0 x80;
SCON=0 x00;
TI=1;
While (1)
{
C=_crol_ (c, 1);
SBUF=c;
While (TI==0);
TI=0;
DelayMS (400);
}
}







Ask why why 74 ls164 did not pick up the clock signal in this circuit can also complete the serial parallel data transformation, and 51 MCU P30 and have the role of P31 port?

The second problem

Why are dangling here can be a high level?
74 ls164 internal pull up resistors should not?

CodePudding user response:

The first question: P31 provides the clock signal by single-chip microcomputer,
The second question: 74 ls164 internal have weak pull-up,

CodePudding user response:

Serial communication is P30 and P31 is open if not set up the state

CodePudding user response:

SCON=0 x00; In the way 0,
Mode 0 (SM0 SM1:0, 0) : the workings of A serial port 0 as the shift register the I/O mode, can be an external shift register, an extended I/O port, can also be external synchronous I/O devices, send operation: when performing A "MOVSBUF, A" instruction, start the send operation, by the TXD shift pulse output, by the data in the serial SBUF RXD, after sending the 8 bits of data automatically buy TI=1. Request the interrupt, to continue to send TI must have instructions, receive operation: REN is serial port receiving control bits are permitted, no receive when REN=0; REN=1 allows the receiving, when the software will REN "1", started from the RXD port fosc/12 baud rate input data, when to receive 8 bits of data, will interrupt flag RI "1", again before receiving data, must use the software to RI qing 0,
  • Related