| ??? 04/11/03 05:40 Read: times |
#43243 - RE: Simple protocol for 2 MCUs communicatio? Responding to: ???'s previous message |
Hai Valentin
I have implemented 2 89c51 connected for want a extra serial port. 1. SlaveINT -> input to slave xternal int 2. command / data -> input to slave 3. Acknowledge -> o/p from slave 4. Data bus Using the above signal lines, i can read/write any of io ports, serial port etc by first writing the commnad reg maintained in the slave. I have predefined command words for the reading and writing the peripherals available in the slave. Command : 0xa0 -> read serial port command : 0xa1 -> write serial port command : 0xb0 -> read port 1 command : 0xb1 -> write port 1 etc. To send a command to read the serial port of slave, i use the following sequence. 1. High the command / slave signal 2. Put the command (0xa0) on the data bus 3. Generate an interrupt by pulling down the slaveINT line. 3. Wait for the acknowledge from slave. Now the command 0xa0 will be loaded into slave command mem register. 4. Low the command / slave signal 5. Make the bus as i/p 6. Generate the interrupt. 7. Wait for the acknowledge. 8. Read the data from bus. 9. exit. If you read a 0xff, there is no data available. This logic you can decide yourself. We can implement some sort of status reg in the slave, then you can determine whether data is available by first reading the status register. Important is Master can initiate communication. V.Nagarajan. |



