Forum Discussion
Altera_Forum
Honored Contributor
18 years agoDE2 Expansion Header
:confused: Hi, I'm trying to do a parallel communication between the CycloneII of the DE2 kit and an external uC. Getting signals out of the DE2 kit on the expansion header is not a problem, b...
Altera_Forum
Honored Contributor
15 years agoHi, many thanks for the codes you posted. However, there's a slight bump in my project that I can't seem to hurdle over and I would greatly appreciate if anyone could point out the mistakes I did.
What I am doing is actually controlling an RC car using FPGA. So, I connect the hardware as shown in this website : http://www.jbprojects.net/articles/rc/ From the controller to the board, I decided to use header, which is where I had problems with. I wrote the code with a simple thought of logic, but I don't know if I wrote it wrongly somewhere. This is the code I came up with --- Quote Start --- input [4:0] KEY; output [19:0] GPIO_0; assign GPIO_0[10] = KEY[0]; assign GPIO_0[12] = KEY[1]; assign GPIO_0[14] = KEY[2]; assign GPIO_0[16] = KEY[3]; --- Quote End --- Forgive me if I am making any obvious mistakes. This is written in such a way that when the KEY is pressed, it will send a bit to the respective header pins. However, when I program it into the DE2, the header pins are '1' even when I did not press any of the KEYs. My friend and I tried another method, but was flooded with errors. The following is the code --- Quote Start --- input [4:0] KEY; output [19:0] GPIO_0; GPIO_0[10] = 1'b0; GPIO_0[12] = 1'b0; GPIO_0[14] = 1'b0; GPIO_0[16] = 1'b0; if(KEY[0]==1 && KEY[1]==1 && KEY[2]==1 && KEY[3]==1) begin GPIO_0[10] = 1'b0; GPIO_0[12] = 1'b0; GPIO_0[14] = 1'b0; GPIO_0[16] = 1'b0; end else begin if (!KEY[0]) GPIO_0[10]=1'b1; if (!KEY[1]) GPIO_0[12]=1'b1; if (!KEY[2]) GPIO_0[14]=1'b1; if (!KEY[3]) GPIO_0[16]=1'b1; end --- Quote End --- I hope someone can point out my mistakes if there are any. I get errors like --- Quote Start --- Error (10170): Verilog HDL syntax error at division.v(28) near text ")"; expecting ".", or an identifier --- Quote End --- but I am not very sure how to tackle this problem. Help? :( Many thanks in advance for the time and help