| ??? 11/25/02 08:08 Read: times |
#33091 - help on Comm. between 89C51 and 8255 |
Dear Friends,
I cannot help but post this question as I got stuck in a fix... The Problem:I want to exchange data between a port (not P0) of AT89C51 and an NEC 82C55A chip. I want the communication to take place somewhat like this... assume CHIP 1 = 89C51 and CHIP 2 = 8255 Code for CHIP 1 (immediately after reset) <code> databus equ P1 ; DataBus is connected between Port 1 of 89C51 and PORT A & B of 8255 signal1 bit P3.2 ; Signal1 comes from 8255 (situated in a PC). Port C.0 of 8255 signal2 bit P3.3 ; signal2 is under the control of CHIP1. Goes to 8255 at Port C.4 ; read data sent by computer (via 8255) jb signal1,$ ; wait until 8255 sends an active low signal mov a,databus ; Move the data sent by 8255 into the accumulator clr signal2 ; Acknowledge the Data Transfer jnb signal1,$ ; Wait until 8255 makes the signal HIGH setb signal2 ; Return the signal to normal State. cpl a ; Complement the Value in A ; send data to 8255 (computer) mov databus,a ; Put the Complemented Value in the databus (port 1) clr signal2 ; Indicate 8255 (programmed to wait until signal arrives) jb signal1,$ ; wait until data is taken by 8255 setb signal2 ; Make the signal high jnb signal1,$ ; Wait until 8255 makes its signal high to complete the transaction. ; again read the data from 8255 jb signal1,$ ; wait until 8255 sends an active low signal mov a,databus ; Move the data sent by 8255 into the accumulator clr signal2 ; Acknowledge the Data Transfer jnb signal1,$ ; Wait until 8255 makes the signal HIGH setb signal2 ; Return the signal to normal State. end </code> Now, here are the doubts I have... 1. Is it possible for me to short Port A and Port B of 8255 and configure them independently as I/P and O/p ports and run the above program, like this... PORT A + PORT B ===== Port 1 of 89C51 so that when I want to read data I issue the read signal from PORT B (say) and whenever I want to write to databus, I use Port A? 2. I understand that the following instruction mov P1,#0ffh configures Port 1 as Input Port. and then I can use the instruction mov a,P1 to read the value that has been put by an external source (like 8255) onto the lines. But how can an external source write any value on a line that has been made high by the controller (i remember an earlier discussion where one person said "if one chip makes a line high then the other chip (connected to it) cannot make it low or vice versa" Is writing 0xff to the port equal to sending the value 0xff (apart from configuring it to be an input port)? -Harsha. |
| Topic | Author | Date |
| help on Comm. between 89C51 and 8255 | 01/01/70 00:00 | |
| RE: help on Comm. between 89C51 and 8255 | 01/01/70 00:00 | |
| RE: help on Comm. between 89C51 and 8255 | 01/01/70 00:00 | |
| RE: help on Comm. between 89C51 and 8255 | 01/01/70 00:00 | |
| RE: help on Comm. between 89C51 and 8255 | 01/01/70 00:00 | |
RE: help on Comm. between 89C51 and 8255 | 01/01/70 00:00 |



