(ix) Serial port mode 0 expansion parallel output port 74ls164 chip

Source: Internet
Author: User

1, first explain the 74ls164 shift chip:

74hc164, 74hct164 is a 8-bit edge-triggered shift register, serial input data, and then output in parallel.

Data is entered serially through one of two inputs (DSA or DSB), and either input can be used as a high-level enable to control data input from another input. Two inputs either connected together, or the unused inputs terminated high, must not be suspended.

Each time the clock (CP) is changed from low to high, the data is shifted right one bit, input to Q0, Q0 is two data input (DSA and DSB) logic with, it will rise clock along the length of a settling time before keeping.

A low level on the primary reset (MR) input will invalidate all other inputs, eliminating the registers synchronously, forcing all outputs to be low. 2, 3, simulation circuit (experimental effect, from the next to the previous LED cycle lit)

4. Reference code:

#include <reg52.h>#include<stdio.h>#defineUchar8 unsigned char#defineuint16 unsigned intsbit p1_0=0x90;//Why write this, P1 port of the byte address is 0x90, as if this writing is meaningless AH//sbit led=p0^6uchar8 Nsendbyte;voidDelay (UInt16 i)//Delay Function{UCHAR8 J;  for(; i>0; i--)      for(j=0;j< the; j + +)      ;} Main () {SCON=0x00; EA=1;//Total interrupt allowedes=1;//allow serial total interruptsNsendbyte=1;//light data initialized to 0000 0001 fed into nsendbyteSbuf=nsendbyte;//write to Sbuf buffer to light data, start serial sendp1_0=0;  while(1)    { ; }}voidSerial_port () Interrupt4 using 0 {   if(T1)//If the t1=1;1 byte is sent in a serial{p1_0=1;//that is 0x90=1;??? allow 74ls164 chip parallel output, LED light Emitting diodeSbuf=nsendbyte;//Write data like Sbuf, start serial sendDelay -); P1_0=0;//p1_0=0; Allow serial write to 74LS164 chipNsendbyte= nsendbyte<<1; if(nsendbyte==0) nsendbyte=1; //determines whether the data is lit 8 times left, and is re-lit .sbuf=Nsendbyte; } TI=0; RI=0;}

Or do you have to be diligent in your own thinking?? Look more, think about it.

(ix) Serial port mode 0 expansion parallel output port 74ls164 chip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.