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.

input and output on the same pic pin ?

Status
Not open for further replies.

kutkm_ti

Newbie level 5
Joined
Oct 4, 2005
Messages
9
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,347
now i face a problem,
i no have any extra pin, so i need to drive a 7 segment led(commom anod) and at the same time, i need input for a push button,

tell me how to do...

any suggestion about when i push the button, it will not affect the led either on or off?

pin-->resistor-->led--> +5v

at the same pin, it will connect to a push button also.
:cry:
 

use two buffers for each of the input and multiplex the input....

what circuit is that you are designing which needs this kind of inputting???....
 

A.Anand Srinivasan said:
use two buffers for each of the input and multiplex the input....

what circuit is that you are designing which needs this kind of inputting???....

what buffer?

the problem is : may i drive the led(commom anod) and read the pin input at the same time? reading the input pin just need take 1us only, but many configuration will make the led not working when i push the button...
:cry:

any suggestion (without use any external IC) to realise that?
 

why u bother so much on 1us
the people can see the 1us off of the led.

any way you can't keep the led on /off ,and same time get a input.need some more circuitry

if you have some shift register you can do it easily

i just attached on of my idea

any way led will be off at 1us
the transistor will off entire 7 segment at the time of reading of push button

if u can give more information about your system we can help more . the pic no. and your suggested circuit diagram

GOOD LUCK
 

my idea is similar like u, i'll try ur circuit, it may use on my project...

dilan2005 said:
why u bother so much on 1us
the people can see the 1us off of the led.

any way you can't keep the led on /off ,and same time get a input.need some more circuitry

if you have some shift register you can do it easily

i just attached on of my idea

any way led will be off at 1us
the transistor will off entire 7 segment at the time of reading of push button

if u can give more information about your system we can help more . the pic no. and your suggested circuit diagram

GOOD LUCK
 

use analog mux.... since you need only 1µs for your switch functioning i think analog mux is the best idea.... analog mux consists of nothing but a MOSFET which acts as a switch and it is bidirectional.... you can multiplex them i.e.give a clock as input to selection line so when it is high one line say the switch gets selected and when it is in low the LED circuit will be selected.... this 1µs will not be noticed due to the storage time of the LED....
 

kutkm_ti said:
now i face a problem,
i no have any extra pin, so i need to drive a 7 segment led(commom anod) and at the same time, i need input for a push button,

tell me how to do...

any suggestion about when i push the button, it will not affect the led either on or off?

pin-->resistor-->led--> +5v

at the same pin, it will connect to a push button also.
:cry:

So you need to "toggle" the function of input and output on the same port pin, this technique is very popular in microcontroller circuits, that you have to get familiar with as soon as possible.

Some websites that must be useful for you:
1. www.microchip.com, of course.
2. www.piclist.com, the best forum for PIC users of the world.
3. www.mikroelektronika.co.yu/english/, the free online PIC books.

For example, you may find out at Microchip website the application note AN557 (Four Channel Digital Voltmeter with Display and Keyboard) with source codes, in which there are 4 subprograms of 4 degrees, you will find out the needed subprogram with the technique for toggling input/output functions. This AN557 is very comprehensive for the PIC beginers.

nguyennam
 

Show us the schematic of your existing circuit, please? How many 7-segment displays?

Mike

Added after 15 minutes:

If you're using something of a 'traditional' 7 segment display setup you should be able to implement a single-pin column driven switch matrix. This will however require an additional pin.

Since you're only ever driving 1 column driver transistor low at any given time, connect each switch through a diode for isolation to that active low PIC pin. You really should be using an interrupt service routine for driving the display and this routine should be selecting and driving a different PIC column pin each interrupt cycle. I normally use a "ring counter" variable to keep track of the column number and I use it as a mask for testing the switches (test 1 switch each interrupt).

Code:
;
        comf    COLPOS,W        ; example ~Column 3 = 11110111
        andwf   SWITCH,F        ; turn off switch flag bit
        movf    COLPOS,W        ; example Column 3 = 00001000
        btfsc   PORTA,SwInPin   ; switch pushed? no, skip, else
        iorwf   SWITCH,F        ; indicate switch pressed (1)
;
;  advance column ring counter for next interrupt cycle
;
        rlf     COLPOS,W        ; rlf into W to preserve C
        rlf     COLPOS,F        ; (similar to 18F rlncf instruction)
;

**broken link removed**
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top