1. Simulation circuit diagram
2, explain the analysis circuit diagram
Did you find it? The above SCM only used the P0 port is not very good, eliminating the need for the key 8 ports
Let's talk about the expansion of the 8255 chip and the peripheral circuitry.
82C55 Chip ——— programmable Universal Parallel Interface Circuit (3 x 8-bit I/O ports)
D0-D7: Tri-State bidirectional data cable, connected with P0 port, used to transmit information with MCU
CS: Chip selection signal
RD: Read signal, active low, to read the control signal of the 82C55 port data
WR: letter number, active low, control signal used to write port data to the 82C55
A1,A0: Address line, used to select 4 ports
Question: Data input latch and data input buffer both will cause the C language code when the difference between the big??????????????????????? Tell me, Help!!!
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
8255 How is the port address of the extension chip determined?
The P2 port of single chip microcomputer is used as high 8 bit of 16-bit I/O address, and P0 port is used for low 8-bit address line and data line multiplexing.
Shut up 8255 of the chip PIN CS Low active, microcontroller P2.7 must be 0,
P2 the remaining bit is 1 (to ensure that the remaining I/O chip in the system CS foot is all 1, not selected), that is, the high 8-bit address is 7Fh;
The lowest two bits of the low 8-bit address P0.1, P0.0 are used to identify 8255 of the four ports (A, B, c port, and control port).
.
If the program defines a 8255 control port address of 7FFFh,
That is, the low 8-bit address is all 1, (8255 of the a1a0 is 11), so:
A port address is 7FFCh (8255 of the a1a0 is 00),
The B port address is 7FFDh (8255 of the a1a0 is 01),
A port address is 7FFEh (8255 of the a1a0 is 10).
.
Of course, there are other options for 82,554 port addresses when programming, such as:
A port address is 7ff0h
B Port Address is 7ff1h
A port address is 7FF2H
Control port Address 7ff3h
Or:
A port address is 7f00h
B Port Address is 7f01h
A port address is 7f02h
Control port Address 7f03h
...... For this diagram of the circuit, 8255 port address, there can be other options, not one by one enumerated.
______________________________________________________________________________________________________
About 8255 working mode select control Word and port PC position and reset control Word, the explanation (********* key *************), specific look Baidu Library
Http://wenku.baidu.com/link?url= Cl1rarmhjatloqt6x9bdouqjh1rrf0t0mnvqszhssh50zx3zphhtihyhz8b8fj6lyycjnwkms-s6rpby76rkxryt7wyfj0w-iu7onwl4zy3
_______________________________________________________________________________________________________________ ____
1#include <reg52.h>2#include <absacc.h>3 #defineuint16 unsigned int4 #defineUchar8 unsigned char5Sbit Xuanzhong = p2^7 ;6 7Sbit rst_8255 = p3^5;8 #definecon_8255 xbyte[0x7003]//define 82C55 Chip control port address P2 port and P0 port, for 0111 0000 0000 0011 is that so??? I don't know, it's very important here.9 #definepa_8255 xbyte[0x7000]//0111 0000 0000 0000Ten #definepb_8255 xbyte[0x7001]//0111 0000 0000 0000 One A voidreset_8255 (void); - voiddelayms (uint16); - the voidMainvoid) - { - Uchar8 temp; -rst_8255=1;//Reset 82c55 Chip +Delayms (1); -rst_8255=0; + Axuanzhong=0; at -con_8255=0x82;//set PB port input, PA port output 1000 0010, as for C Port first not consider - //(Here we will learn 8255 ways to choose the control word and port PC set/reset control Word, here is the most important place, understand, there is no problem) - while(1) - { -temp=pb_8255; inpa_8255=temp; - to } + - } the * voiddelayms (uint16 j) $ {Panax Notoginseng uchar8 i; - for(;j>0; j--) the { +I= -; A while(--i); theI=249; + while(--i); - $ } $ -}
8255 chip Address determination and working mode control Word and port PC Settings/Reset is the difficulty of learning!!!!!!!!!!! (if it's going to be basic, it'll be fine.)
(10) Single chip microcomputer extended parallel I/O interface chip 8255 chip