Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

provide more then 32 i/o with 89c51

Status
Not open for further replies.

ronydc

Full Member level 3
Joined
Nov 17, 2005
Messages
166
Helped
4
Reputation
8
Reaction score
3
Trophy points
1,298
Activity points
2,612
communication between two 89c51+pdf

HELOO friends,

i am stuck at a project situation.

the requirement is:
using 89c51 microcontroller(Atmel)i need to provide
the following.

1> with 16 switches 16 relays are to be operated.
2> with same controller ckt, i need to provide I2C interface ( 24c04)
3> with same controller ckt, i need to provide serial communication.


the problem is:

i dont get any extra pins on 89c51 MCU after satisfying the first
requirement of 16 switchaes and 16 relays ....!!

how to add I2C interface ( 2 pins needed )
serial interface( 2 pins needed)

so total i need more 4 pins after providing the 16 switches
and 16 relays as the maximum i/o pins available on this 40 pin device is 32
i am stuck... wht to do.

please advise... and send me if any ckt dia and extra coding required.

please note: i am known to the coding for i2c and serial comm. so thts not the problem.

thanks in avance.

rony.
 

mcp23017 ccs

Hello

Can you not use the existing 16 connections and flip there logic or are they constantly in use ?.ie cycle 1= all pins are at v+ cycle 2= all pins are at -v you'll need some delays in between switching but this way you get 32 outputs i think ????.



:|
 

mcp23017 example

You can use I2C port expander to drive the relays. For example MCP23017

**broken link removed**
 

74hc154 32

Use shift register that you can drive with simple synchronous serial interface. You can use any two pins to generate clock and data to shift register.
 

c example programs parallel i/o ports for 89c51

Using shift register is the best option.

Try googling with port expander.

Regards
Nandhu
 

i need more io pins

You don't need 16 inputs to read your switches, you can do it with 8 i/o pins.
 

mcp23017 port expander

Check the attached pdf
LCD (4 bit mode), 4*4 keypad, E²PROM, RTC, 12 digital I/O, 4 analog IN, 1 analog OUT and RAM all on 2 pins of a AT89C2051
using I²C bus of course :)

So regarding your app
1) 32 I/O is 4 times PCF8574 (each with another address of course)
2) I²C on pins P1.7 & P1.6 of controller
3) serial comm on P3.0 & P3.1 of controller

hardware done
since you know I²C coding your problem is solved :)
 

ccs c spi mcp23017

You can use a 4 to 16 line decoder (74HC154) for the relays and two of your ports for the switches, two pins for I2C, and you can use the hardware uart.

Good Luck
 

p89c51 io port

Run two pins into a 74138 decoder to select one of 4 74373 latches or 74374 latches . Use one pin for clk. One of the latches could be a tristatable serial to parallel chip that you could run the data onto with one pin insted of 8. Then strobe it out onto the appropriate latch. But the I2C or SPI expander chips are the best choice. Tough little bastards to understand though (lots of registers), if you have a C compiler that has a library to handle them that is a plus. CCS saved me a lot of time in being able to use them.
 

ccs mcp23017

thanks friends for answering my query.
let me find out the best way from ur supportive answers.
i will let you all know.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top