Altera_Forum
Honored Contributor
20 years agoHow to read output port?
I need to read state of some output ports in my application.
In some part of the program I write these ports and in other part I want to read actual state and I wouldn't like to use special variables to keep the states. I cannot quite understand the "tristate" meaning in Altera peripheral handbook, but it seems to me that this is what I need. I already have tested it (with first setting the direction of the port to 1 to become tristate) and it seems to be working fine. Since I don't fully understand the datasheet explanation, can somebody please confirm that I am doing it right and not setting something else, which can eventually cause some problems in my application? Peripheral handbook says this: <div class='quotetop'>QUOTE </div> --- Quote Start --- Bidirectional (tristate) ports: In this mode, each PIO bit shares one device pin for driving and capturing data. The direction of each pin is individually selectable. To tristate an FPGA I/O pin, set the direction to input.[/b] --- Quote End ---