2012年10月27日 星期六

P6-18 8bit latch 適用於DE2-70

P6-18 8bit latch 適用於DE2-70




//------------------------------------
//8-bit latch using if... statement
//Filename : latch8_if
//------------------------------------

module latch_8bit (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
  
  
//set original program input , output 

    // output [7:0] y;
   // input load;     //latch signal
    // input [7:0] din;
    
    //wire [7:0] y;
wire load;
wire [7:0] din;

reg [7:0] y=8'b0;
    
    
    //mapping to hardware 
    assign LEDR = SW;
    
    assign load=SW[17];
    assign din=SW[7:0];   
      
   
always @ (y or load)
begin
if (load)
y = din;
end

    assign LEDG[7:0]=y;

endmodule

沒有留言:

張貼留言

ESP32 微控制器 採集的環境數據,經由 MQTT 協定 轉換並寫入工業標準的 Modbus 暫存器 中

  一個典型的 IoT(物聯網)與工業自動化系統整合(SCADA/機台連線) 的架構圖。它透過 Node-RED 作為核心資料網關,將前端 ESP32 微控制器 採集的環境數據,經由 MQTT 協定 轉換並寫入工業標準的 Modbus 暫存器 中。 1. 各模組功能拆解...