// ********************************************************************
// The TouchReg module shifts in the touch screen coordinates which are // sent by the microcontroller. Data gets shifted to the right as it
// gets in, so the first byte is at 'right' end of ByteData

module TouchReg (CLK,DataBus,SHData,FirstByteData,SecondByteData,ThirdByteData,FourthByteData) ;

input CLK ;
input [3:0] DataBus ;
input SHData ;

output [7:0] FirstByteData ;
output [7:0] SecondByteData ;
output [7:0] ThirdByteData ;
output [7:0] FourthByteData ;

reg [31:0] ByteData ;

assign FourthByteData = ByteData[31:24];
assign ThirdByteData = ByteData[23:16];
assign SecondByteData = ByteData[15:8];
assign FirstByteData = ByteData[7:0];

// Shift right as low order nibbles come first
always @(posedge CLK) begin
  //Low order is sent first....
  if (SHData) ByteData = { DataBus, ByteData[31:4] };
end

endmodule
 
 

Back to Report