Cyclone II-Exp.4


Code was simple enough:

module KEY_OR_LED ( A, B, F );

input A, B;
output F;
assign F = A||B;


But the pin assignments in the default example project didn’t make sense, they were set to:




I went with it, just in case I was missing something, but compiled, bombed and no LED lit.

Changed to:







But held my breath and restarted and got a circuit that worked counter intuitively until I dusted off me logical thinking.  No LED lit if either of the buttons weren’t pressed.

No LED lit if one of the buttons pressed and … finally … LED lit when both buttons pressed.

Basically both inputs are held high by a 4.7K ohm resistor and you need to drive both low to drive the LED low because of the OR function (either input high then high at output then LED sees same voltage at each of it’s pins – 3.3V).

All good.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: