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.

I/O expansion in pic18f452

Status
Not open for further replies.

yaswanthsai

Newbie level 6
Joined
Jul 19, 2009
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,362
can any one plz tell me how to expand ports in pic18f452. there are 5 ports in pic18f452. i used all ports. i want 8 more pins(0ne port) . for that i planned to interface with 8255 to increase the ports. so plz help me how to interface 8255 to pic18f452 to increase the ports
 

You could just use two 8-bit latch (register) chips such as 74HCT273 to expand one 8 bit port to two.
 

but i want to send different values to two ports. i have one port(8 bits) is free. but i want to send RTC values and also adc values. so i want to 2 eight bit ports. so how to increse two 8 bit ports from one 8 bit port.
 

Let's assume you want to expand PORTB to 16 bits. You've got two 74 chips.

You need one more pin (PORTE.0 for example). You connect PORTE.0 to the 'clock' input of one 74 chip and through an inverter to the clock input of the other 74 chip.

You connect all 8 pins of PORTB to the inputs of both 74 chips.

Then, when you put PORTE.0 low, value of PORTB will be 'latched' in one of the chips, and when you put PORTE.0 to high, it'll be on the other.

Remember, though - this will slow down the speed of the port. It will take 3-4 instructions to 'fill' both 74 chips with data.

Code:
BCF  PORTE,0       ;low to high
MOVLW %01010101   ; first 74 chip
MOVWF PORTB
NOP
MOVLW %10101010   ; second 74 chip
MOVWF PORTB
BSF  PORTE,0       ;high to low (when inverted - low to high)
 

THANK U. BUT IN PROJECT BOTH DATA WANT TO RUN AT A TIME. THAT IS rtc DATA I WANT TO DISPAY AND AT THE SAME TIME I WANT TO SEND ADC VALUE. I HAV port A AND portE AND portB IS FREE. SO I WILL SEND ADC VALUE TO portB. THEN I WANT TO DISPLAY RTC VALUE 8 BITS. BUT PORTA I HAV 6 PINS AND PORT E I HAV 3 PINS. "SO HOW TO SEND 8 BITS TO PORTA AND PORTE." THE 8 BITS ARE RTC SECOND VALUE WITH IS IN BCD FORMAT. THAT DATA I HAV TO SEND AND DISPLAY IN BCD 7 SEGMENT DISPLY.
 

It's physically impossible to "run it at a time" - it's a single MCU with a single processor, and a sequential code running on it. Only one thing can happen at a time.

Splitting data across two ports (A and E) would actually be slower than using latches.
 

Never used that (if you're referring to the PPI), so I wouldn't know.
 

but i am already using spi configuration to get seconds data from real time clock.

whther 8255 interface is possible
 

The 8255 is an option. Just write to it's registers and you are fine.
It is only going to give you 24 IO and address decoding is needed. I guess you could use a uC spare IO pin and just toggle it when needed.

The nice thing about the MCP is that there are only 4 interface lines. You can then daisy chain up to 8 of them (128 IO total). Not bad for 4 pins.

Red
 

Hey,

You can also use serial to parallel shift registers, like 74hc595 which can give output of many pins by just 3 input pins..

NIKS
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top