Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Altera bidirectional pins

465 views
Skip to first unread message

Ezra Harrington

unread,
Dec 6, 2000, 3:00:00 AM12/6/00
to
I'm having difficulties getting bidirectional pins working on an Altera
PLD. I need to have two 8-pin bidirectional ports, D1 and D2.
Sometimes the input from D1 has to be output to D2, and sometimes the
input from D2 has to be output to D1. Should I just be able to use
statements like 'D1 <= D2' or 'D2 <= D1', or do I need to have an
intermediary internal signal, or do I need to do something else all
together.

I looked at some example code on Altera's website, and the few I found
were not very helpful. They weren't very close to what I need to do.

Any help that can be offered would be greatly appreciated. Thanks.

Ezra Harrington


Sent via Deja.com http://www.deja.com/
Before you buy.

Andreas Ackermann

unread,
Dec 7, 2000, 3:00:00 AM12/7/00
to
Ezra Harrington wrote:

> I'm having difficulties getting bidirectional pins working on an Altera
> PLD. I need to have two 8-pin bidirectional ports, D1 and D2.
> Sometimes the input from D1 has to be output to D2, and sometimes the
> input from D2 has to be output to D1. Should I just be able to use
> statements like 'D1 <= D2' or 'D2 <= D1', or do I need to have an
> intermediary internal signal, or do I need to do something else all
> together.
>
> I looked at some example code on Altera's website, and the few I found
> were not very helpful. They weren't very close to what I need to do.

If the PLD features tristate ports I'd do it like this:

d1 <= any_signal when my_condition = '1' else "ZZZ...ZZZ";

As a source, you can use it like any normal input pin:

any_signal <= d1;

Hope this helps.

-Andreas

harvey...@my-deja.com

unread,
Dec 7, 2000, 12:15:47 PM12/7/00
to
In my department we teach VHDL but find it VERY DIFFICULT to implement
complex circuits that work in VHDL using Altera's VHDL Compiler.

Therefore usually for MOST projects we just use Altera's MegaFunction
to generate all the Generic Functions such as counters, shift registers
and what you need:

Bi-Directional Buffers

We also find that COMBINING heiarchical sheets of BOTH VHDL and the
Schematic MegaFunctions DO work reliably.

Therefore if your problem is only the the Bi-Directional problem then
link that in as a schematic MegaFunction with your existing VHDL code.

I'll email some example files on request.

___________________________________________

H A R V E Y T W Y M A N

Department of Electronics,
University of Kent.
Canterbury. U.K.

ABOUT ME: http://www.Twyman.org.uk/CV.htm
EMAIL ME: H.E.T...@ukc.ac.uk

___________________________________________


In article <90mep7$1tk$1...@nnrp1.deja.com>,


Ezra Harrington <tv...@my-deja.com> wrote:
> I'm having difficulties getting bidirectional pins working on an
Altera
> PLD. I need to have two 8-pin bidirectional ports, D1 and D2.
> Sometimes the input from D1 has to be output to D2, and sometimes the
> input from D2 has to be output to D1. Should I just be able to use
> statements like 'D1 <= D2' or 'D2 <= D1', or do I need to have an
> intermediary internal signal, or do I need to do something else all
> together.
>
> I looked at some example code on Altera's website, and the few I found
> were not very helpful. They weren't very close to what I need to do.
>

KF

unread,
Dec 8, 2000, 3:21:17 PM12/8/00
to
You can setup a direction regiseter which would control ur port I/O
direction. Example of an 8 bit bi-directional port

port0 is bidirectinal port
dir_reg is ur direction control register


for i in 0 to 7 loop

if dir_reg(i) = '1' then
port0 <= 'Z';
elsif dir_reg = '0' then
port0 <= '0';
end loop;

to configure the port as input u would have write all 1 to dir_reg(i) bit.
To output values simply write to dir_reg register.

Hope this helps

"Andreas Ackermann" <ac...@rommel.stw.uni-erlangen.de> wrote in message
news:3A2F968B...@rommel.stw.uni-erlangen.de...


> Ezra Harrington wrote:
>
> > I'm having difficulties getting bidirectional pins working on an Altera
> > PLD. I need to have two 8-pin bidirectional ports, D1 and D2.
> > Sometimes the input from D1 has to be output to D2, and sometimes the
> > input from D2 has to be output to D1. Should I just be able to use
> > statements like 'D1 <= D2' or 'D2 <= D1', or do I need to have an
> > intermediary internal signal, or do I need to do something else all
> > together.
> >
> > I looked at some example code on Altera's website, and the few I found
> > were not very helpful. They weren't very close to what I need to do.
>

news.blueyonder.co.uk

unread,
Dec 9, 2000, 1:55:22 PM12/9/00
to
Without knowing more I would say you need to assign the 'Z' state to port
that is to be used for input, such as,

if DIR = '1' then
D1 <= ( others => 'Z' );
D2 <= D1;
else
D2 <= ( others => 'Z' );
D1 <= D2;
end if;

Cheers

Dave.


"Ezra Harrington" <tv...@my-deja.com> wrote in message
news:90mep7$1tk$1...@nnrp1.deja.com...


> I'm having difficulties getting bidirectional pins working on an Altera
> PLD. I need to have two 8-pin bidirectional ports, D1 and D2.
> Sometimes the input from D1 has to be output to D2, and sometimes the
> input from D2 has to be output to D1. Should I just be able to use
> statements like 'D1 <= D2' or 'D2 <= D1', or do I need to have an
> intermediary internal signal, or do I need to do something else all
> together.
>
> I looked at some example code on Altera's website, and the few I found
> were not very helpful. They weren't very close to what I need to do.
>

0 new messages