PDA

View Full Version : Share ports



ruijc
- 4th March 2008, 14:40
Hi all,

just a doubt i have...

Imagine i have a circuit with a 16F88 with all ports ocupied. 6 of them are output with leds.

Is it possible to share these 6 ports to be used as output for leds in one section of the code and as input/output for LCD in other section of the code ?

Thanks
.

skimask
- 4th March 2008, 14:50
Hi all,
just a doubt i have...
Imagine i have a circuit with a 16F88 with all ports ocupied. 6 of them are output with leds.
Is it possible to share these 6 ports to be used as output for leds in one section of the code and as input/output for LCD in other section of the code ?
Thanks
.

Sure. Set up another pin to be the back side of the LEDs.
If you want to fire the LEDs, the 'other' pin is the ground for them. If you want to send data to the LCD, set the 'other' pin to an input. The LEDs don't light up and the LCD works normally.

ruijc
- 4th March 2008, 17:21
Greetings Skimask,

This means i can hook the lcd in the same pins as the leds.

Code speeking i can define the ports for the lcd at the top of the code and work with the leds anyway, right ?

And when i need the LCD i just change the port related with driving the ground to the leds ( turning off the leds ) and work with the LCD.

No more code is required except changing the state of this particular port, am i right ?

skimask
- 4th March 2008, 21:17
Greetings Skimask,

This means i can hook the lcd in the same pins as the leds.

Code speeking i can define the ports for the lcd at the top of the code and work with the leds anyway, right ?

And when i need the LCD i just change the port related with driving the ground to the leds ( turning off the leds ) and work with the LCD.

No more code is required except changing the state of this particular port, am i right ?

Pretty much. The LEDs might blink when accessing the LCD, and you'll have to make sure that your LCD's E line is an isolated line.