Cyclone II-Exp.4


Gag!

Code was simple enough:

module KEY_OR_LED ( A, B, F );

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

endmodule

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

wrong

wrong

 

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

Changed to:

right

right

Got:

again

again

 

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.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: