FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
6210 Discussions

and gate acting as or and vysa versa

rvais1
Beginner
644 Views

hey

I'm new to altera fpga , I've bought development board based on EP4CE6E22 cyclon IV and tryed to program it with basic program in quartus environment

 

module my_and(a,b,c); input a,b; output c; assign c = a & b; endmodule

I've loaded pin assignment from files that came with the board and programmed it with some chinese jtag blaster.

 

but when i tryed to push one or the other or both (attached to a,b signals)button - the led turned on , and went off when released (like OR GATE)

 

so i tryed to program it as OR GATE gate and the board started acting like AND GATE

 

am i doing somthing wrong?

 

0 Kudos
1 Solution
ak6dn
Valued Contributor III
361 Views

Check the logic sense of your switches and LED pins. You are assuming PUSHed=1 and not=0, and out=1 for LED on, and out=0 for LED off.

 

On many/most all boards pushbuttons will be connected to a pin with a pullup, so the default input will be a '1' (high). When you push it it goes to a '0' (low).

 

The LED could be driven either active high ('1' high for ON, '0' low for OFF) or active low ('1' high for OFF, '0' low for ON). Check the schematic/docs for which way on your board.

View solution in original post

0 Kudos
1 Reply
ak6dn
Valued Contributor III
362 Views

Check the logic sense of your switches and LED pins. You are assuming PUSHed=1 and not=0, and out=1 for LED on, and out=0 for LED off.

 

On many/most all boards pushbuttons will be connected to a pin with a pullup, so the default input will be a '1' (high). When you push it it goes to a '0' (low).

 

The LED could be driven either active high ('1' high for ON, '0' low for OFF) or active low ('1' high for OFF, '0' low for ON). Check the schematic/docs for which way on your board.

0 Kudos
Reply