Altera_Forum
Honored Contributor
13 years agoHelp on clock pin assignment
Hello, I'm new with FPGA programming. I created a simple program to generate PWM, but when I assigned the clock it shows as an error on compilation. Here is my code:
module PWMTest (clock, switches, pwm_o); parameter sd = 3125; //t = 1ms, p = t/(20*10^-9), p = 50000, sd = 3125 input clock; input [3:0] switches; output pwm_o; reg pwm; reg [16:0] counter = 0; always @ (posedge clock) begin counter = counter + 1; if (counter <= switches*sd) pwm_o = 1; else pwm_o = 0; if (counter == 50000) counter = 0; end endmodule the clock is assigned to H1 or DCLK pin (according to De0 Nano board), but when I turned on the Live I/O check, it said error on line 5 (input clock;) can somebody help me?