📄 cpld_for_lcd.v
字号:
module cpld_for_lcd
(
RED,GREEN,BLUE,BUFFERED_CLOCK,MSTR_nRST,
LCD_TYPE,
LCD_DON,LCD_REV,LCD_CLS,LCD_PSAVE,uP_PC6,LCD_MOD,
LCD_MDISP,LCD_HSYNC,LCD_VSYNC,LCD_SPL,
LCD_D,VS,HS,DE
);
input [17:0] LCD_D;
input LCD_MDISP,LCD_HSYNC,LCD_VSYNC,LCD_SPL;
input LCD_DON,LCD_REV,LCD_CLS,LCD_PSAVE,LCD_MOD;
input BUFFERED_CLOCK,MSTR_nRST;
input [2:0]LCD_TYPE;
input uP_PC6;
output VS,HS,DE;
output [7:0] RED,GREEN,BLUE;
reg [7:0] RED,GREEN,BLUE;
reg VS,HS,DE;
`define LOW 1'b0
`define HIGH 1'b1
`define lcd_24bit 'h00
`define lcd_18bit 'h01
wire [15:0]LCD_D_BUF;
wire DE_BUF,VS_BUF,HS_BUF;
buf (DE_BUF,LCD_MDISP);
buf (VS_BUF,LCD_VSYNC);
buf (HS_BUF,LCD_HSYNC);
buf (LCD_D_BUF[15],LCD_D[15]);
buf (LCD_D_BUF[14],LCD_D[14]);
buf (LCD_D_BUF[13],LCD_D[13]);
buf (LCD_D_BUF[12],LCD_D[12]);
buf (LCD_D_BUF[11],LCD_D[11]);
buf (LCD_D_BUF[10],LCD_D[10]);
buf (LCD_D_BUF[9],LCD_D[9]);
buf (LCD_D_BUF[8],LCD_D[8]);
buf (LCD_D_BUF[7],LCD_D[7]);
buf (LCD_D_BUF[6],LCD_D[6]);
buf (LCD_D_BUF[5],LCD_D[5]);
buf (LCD_D_BUF[4],LCD_D[4]);
buf (LCD_D_BUF[3],LCD_D[3]);
buf (LCD_D_BUF[2],LCD_D[2]);
buf (LCD_D_BUF[1],LCD_D[1]);
buf (LCD_D_BUF[0],LCD_D[0]);
always @(MSTR_nRST or LCD_D_BUF/*posedge BUFFERED_CLOCK,negedge MSTR_nRST*/)
begin
if (~MSTR_nRST)
begin
//VS=`LOW; //初始值待定
//HS=`LOW;
//DE=`LOW;
end
else
begin
VS=VS_BUF;
HS=HS_BUF;
DE=DE_BUF;
//case (LCD_TYPE)
//`lcd_24bit:
//begin //24位显示
BLUE[7]=LCD_D_BUF[14];
BLUE[6]=LCD_D_BUF[13];
BLUE[5]=LCD_D_BUF[12];
BLUE[4]=LCD_D_BUF[11];
BLUE[3]=LCD_D_BUF[10];
BLUE[2]=LCD_D_BUF[15];
BLUE[1]=LCD_D_BUF[15];
BLUE[0]=LCD_D_BUF[15];
GREEN[7]=LCD_D_BUF[9];
GREEN[6]=LCD_D_BUF[8];
GREEN[5]=LCD_D_BUF[7];
GREEN[4]=LCD_D_BUF[6];
GREEN[3]=LCD_D_BUF[5];
GREEN[2]=LCD_D_BUF[15];
GREEN[1]=LCD_D_BUF[15];
GREEN[0]=LCD_D_BUF[15];
RED[7]=LCD_D_BUF[4];
RED[6]=LCD_D_BUF[3];
RED[5]=LCD_D_BUF[2];
RED[4]=LCD_D_BUF[1];
RED[3]=LCD_D_BUF[0];
RED[2]=LCD_D_BUF[15];
RED[1]=LCD_D_BUF[15];
RED[0]=LCD_D_BUF[15];
//end
//`lcd_18bit:
//begin //18位显示
/* BLUE[7]=LCD_MOD;
BLUE[6]=LCD_SPL;
//BLUE[7]=LCD_D_BUF[7];
//BLUE[6]=LCD_D_BUF[7];
GREEN[7]=LCD_REV;
GREEN[6]=LCD_PSAVE;
//GREEN[7]=LCD_D_BUF[15];
//GREEN[6]=LCD_D_BUF[15];
RED[7]=LCD_DON;
RED[6]=uP_PC6;
//RED[7]=LCD_D_BUF[15];
//RED[6]=LCD_D_BUF[15];
BLUE[5]=LCD_D_BUF[14];
BLUE[4]=LCD_D_BUF[13];
BLUE[3]=LCD_D_BUF[12];
BLUE[2]=LCD_D_BUF[11];
BLUE[1]=LCD_D_BUF[10];
BLUE[0]=LCD_D_BUF[15];
GREEN[5]=LCD_D_BUF[9];
GREEN[4]=LCD_D_BUF[8];
GREEN[3]=LCD_D_BUF[7];
GREEN[2]=LCD_D_BUF[6];
GREEN[1]=LCD_D_BUF[5];
GREEN[0]=LCD_D_BUF[15];
RED[5]=LCD_D_BUF[4];
RED[4]=LCD_D_BUF[3];
RED[3]=LCD_D_BUF[2];
RED[2]=LCD_D_BUF[1];
RED[1]=LCD_D_BUF[0];
RED[0]=LCD_D_BUF[15];*/
//end
/*'h02:
begin
//待定
end
endcase*/
end
end
endmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -