- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi
I write a simple code to implement AND gate with pushbuttons and LED on cyclone iv ep4ce6e22c8n.
but it acts like OR gate, it means that when I press one of the pushbuttons or both, the LED turns on. I try to implement OR gate and it acts like AND gate! when I press both of the pushbutton, the LED turns on. what should I do to solve this problem?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Very likely because the pushbutton inputs are active low and not active high.
So when you push the button, the FPGA input sees a LOW value.
When the button is not pushed, it defaults to a HIGH value.
Schematically, the pushbutton is connected to GROUND and the FPGA input, which has a pullup to VCC to set the unpushed state.
An active low logic AND function becomes an active high logic OR function, and vice versa.
So simple fix is to invert the sense of the input from each pushbutton (add a NOT function).
Most likely your LED output is active HIGH (meaning when the output is high the LED is ON) but it could be inverted as well.
You may or may not need to add a NOT to the output LED driver, so when the output is HIGH the LED is ON.
It depends upon the design of your board.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Very likely because the pushbutton inputs are active low and not active high.
So when you push the button, the FPGA input sees a LOW value.
When the button is not pushed, it defaults to a HIGH value.
Schematically, the pushbutton is connected to GROUND and the FPGA input, which has a pullup to VCC to set the unpushed state.
An active low logic AND function becomes an active high logic OR function, and vice versa.
So simple fix is to invert the sense of the input from each pushbutton (add a NOT function).
Most likely your LED output is active HIGH (meaning when the output is high the LED is ON) but it could be inverted as well.
You may or may not need to add a NOT to the output LED driver, so when the output is HIGH the LED is ON.
It depends upon the design of your board.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I’m glad that your question has been addressed, for now I will set this case to Close-Pending.
Regards,
Nazrul Naim

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page