Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

How to read output port?

Altera_Forum
Honored Contributor II
1,297 Views

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 ---  

0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
449 Views

there are two cases for ports: 

 

1. port signals are connected to real in/outputs of fpga 

( i think it&#39;s ok to use tristate signals to read back the setting of  

the outputs) 

 

2. port signals are used internal in fpga  

(tristate does not make sense, I don&#39;t know if quartus syntesizes 

tristate registers away ?) 

 

because I had some signals with case 2 and also wanted to read back 

the settings of the outputs, i made ports with input and output  

(no tristate) and connected in/outputs of these ports together  

in the top schematic. 

 

perhaps someone from altera can explain what will happen if i use tristate for 

internal port signals ?
0 Kudos
Reply