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

Logic determination

Altera_Forum
Honored Contributor II
1,297 Views

Hi all, 

 

I'm using EP1C12F324C8 device on which there are 2 SW's and 10 LED's for USER. 

 

How can I determine the logic of a SW when I press it ? 

 

How can I determine the logic of an LED when it brights ? 

 

Thanks, 

 

OneNet
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
299 Views

Leds and pushbuttons have either pullups or pulldowns. When there is a pullup the logic is reversed (so if you push a button you get a 0, or if you want the LED to turn on you write a 0). With a pulldown the 'on' logic is a '1'. To determine if a signal is pulled up or down you have to look at the hardware schematics to see if there is a resistor between the signal and Vcc (voltage supply) or if the resistor goes between the signal and Gnd (ground which looks like 3 horizontal lines) you have a pulldown. If you are not accustom to hardware schematics and you have a board already you can try this with trial and error (test buttons by constantly reading and printing on the screen the value you read with the button pushed and not pushed) and the same thing with LEDs (write all 1's to see if the LEDs are on or off). Most hardware designers use pullups but one can't be sure without investigating this. 

 

As a last note are you using a development purchased development board? If so someone in here may have that board and can just tell you what the logic will be. I know the Nios Eval board uses pullups on the buttons and I'm pretty sure it has pullups on the LEDs as well.
0 Kudos
Reply