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

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) 3) 使用database需先create建立資料庫 Node-Red 程式 [...