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.

How to define BiDirectional i/o pins for PIC Microntroller ?

Status
Not open for further replies.

asking

Full Member level 5
Full Member level 5
Joined
Sep 21, 2010
Messages
279
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Visit site
Activity points
3,377
Hello guys,

i am using 16F628A for Multiplexing 7 Segment display. So my Port A has only 4 pins used. Now i want to use two pins for SCL/SDA (soft i2c)

i want to use soft i2c connection and that is where i m stucked. If i define TRISA = 0 (means all pins are set for output) then how can i define

sbit Soft_I2C_Scl at RA6_bit;
sbit Soft_I2C_Sda at RA7_bit;

because i think in serial i2c is bidirectional...so m confused...because 16F628A has no hardware i2c.

but how is it possible ? As we have already define TRISA = 0 (means all pins on PortA is output) then how it will works as input/out bidirectional ?

please help m really confused..about how to define any pin on pic microcontroller as bidirectional

any help would be appreciated..
 
Last edited:

One possible option is the use of a Port Expander or Shift Register.

6 Digits 7-Segment LED Multiplexing using a Shift Register

The port pins of a PIC can only be configured as input or output, not bidirectional, however the direction of a port pin can be changed during runtime via software.

Typically hardware peripheral modules like the USART, SPI, I2C, etc require the port pins used by the hardware peripheral module be initially configured to a known state/direction, the peripheral module then changes the direction of the pin as required during operation.

The same is true of software implement peripherals or soft peripherals, the ports pins are initially configured to a required state/direction and it is the task of the software routine to change the direction of the port pin as required during execution.


BigDog
 
  • Like
Reactions: asking

    asking

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top