2012年11月6日 星期二

DE2 GPIO expansion Relay + LED實驗 + SW (3)


DE2 GPIO expansion Relay + LED實驗 + SW (3)
//   output [35:0]GPIO_0;
//   input  [35:0]GPIO_1;
//  assign GPIO_0 = GPIO_1[0] ? cnt : {32{cnt[26]}};






module EX_3 (GPIO_0 ,GPIO_1 , SW, LEDR, LEDG , CLOCK_27 ,KEY );

input  [17:0] SW; // toggle switches
input  [7:0] KEY;     // Push bottom
input  CLOCK_27; //Clock 27MHz , 50Mhz

output [17:0] LEDR; // red  LEDS   
  output [7:0] LEDG; // green LEDs
  
    output [35:0]GPIO_0;
input  [35:0]GPIO_1;
  
    reg [31:0] cnt;
    
    
    always @(posedge CLOCK_27)
          cnt <= cnt + 1;
   
   assign GPIO_0 = GPIO_1[0] ? cnt : {32{cnt[26]}};
   assign LEDR   = GPIO_0[31:14];
   assign LEDG[7:0] = GPIO_1[27:20];
       
endmodule

沒有留言:

張貼留言

MQTT Explorer 與 Node-Red 介面的實驗

 MQTT Explorer 與 Node-Red 介面的實驗 MQTT EXplorer 與 Node-Red介面的設定 (1) 設定  MQTT EXplorer Client    (2)        Node-Red LED ON  --> MQTT Explor...