If the project possibly implies designing a HD44780 model for test purposes (you don't clearly tell about this point), it can only apply to the digital part (bus interface and controller) not the analog part (LCD driver).
`timescale 1ns / 1ps
module HD44780(RS, RW, E, DB, DB1);
//MPU Interface
input RS, RW, E; //
input [7:0]DB1;
output [7:0]DB;
// When RS = 0 and R/W = 1 (Table 1), the busy flag is output to DB7.
reg[7:0]DB;
wire [6:0]IR_AC;
wire [6:0]AC_DD_DB;
wire [7:0]DD_CG;
wire [7:0]DR_CG;
wire [4:0]CG_PSC;
wire [7:0]TG_DDR;
//moduli
Data_Reg DR(.DR_input(DB), .RS(RS), .RW(RW), .DR_output(DR_DD), .CLK(E));
Inst_Reg IR(.IR_input(DB), .IR_out(IR_AC),.CLK(E), .RS(RS), .RW(RW));
Adr_count AC(.Adr_in(IR_AC),.Adr_out(AC_DD_DB), .CLK(E), .RS(RS), .RW(RW)); //The AC contents are then output to DB0 to DB6 when RS = 0 and R/W = 1 (Table 1).
DDRAM DD(.Adr_in(AC_DD_DB), .DDR_out(DD_CG), .DR_in(DR_DD), .TG_in(TG_DDR), .CLK(E), .CLK_RW(RW));
CGROM CG(.DDR_out(DD_CG), .CLK(E), .DDR_in_adr(DR_DD), .PSC_out(CG_PSC));
Timing_Generator TG(.TG_out(TG_DDR));
always@(DB1) DB=DB1;
endmodule
module Data_Reg(DR_input, DR_output, CLK, RS, RW); //Data registar
input[7:0]DR_input;
output[7:0]DR_output;
input CLK, RS, RW;
endmodule
module Inst_Reg(IR_input,IR_out, CLK, RS, RW);
input[7:0]IR_input;
input CLK, RS, RW;
output [6:0]IR_out;
reg [6:0]IR_out;
always@(posedge CLK)
begin
if(RS==0 && RW==0)
begin
if(IR_input == 8'b0000001)
IR_out = 7'h20;// clear display
/*if(IR_input == 8'b000001z)//return home
if(IR_input == 8'b0000100)// samo dekremenitiraj
if(IR_input == 8'b0000101)// dekremenitiraj i shiftaj
if(IR_input == 8'b0000110)// samo inkrementiraj
if(IR_input == 8'b0000111)// inkremenitiraj i shiftaj
if(IR_input == 8'b0001000)// display off
if(IR_input == 8'b0001111)// display on, cursor i blinkaj je on
if(IR_input == 8'b00111zz)// display shift, pomakni desno
if(IR_input == 8'b00110zz)// display shift, pomakni livo
if(IR_input == 8'b00100zz)// UGASI shift, pomakni livo
if(IR_input == 8'b00100zz)// UGASI shift, pomakni DESNO
if(IR_input == 8'b01100zz)// odabir 8, 5*8 slova, jedna linija itd.*/
end
end
reg [7:0]inst_reg;
always @(posedge CLK)
inst_reg = IR_input; //spremi trenutnu naredbu koju dobij
endmodule
module Adr_count(Adr_out, Adr_in, CLK, RS, RW);
input [6:0]Adr_in;
input CLK, RS, RW;
output[6:0]Adr_out;
reg[6:0]Adr_out;
reg[6:0]AC;
always @(CLK) AC <= 0;
always@(Adr_in)
begin
AC <= AC + 1'b1; //kad primi¹ adresu za DDRAM uveæaj za 1
Adr_out = Adr_in;
if(Adr_in==6'h20)
begin
AC <= 0; //za funciju clear display
Adr_out = Adr_in;
end
end
endmodule
module DDRAM(Adr_in, DDR_out,DR_in, TG_in, CLK_RW, CLK);// treba sinkronizirati ovos ve
input [7:0]Adr_in, TG_in, DR_in;
input CLK, CLK_RW;
output [7:0]DDR_out;
reg [7:0]DDR_out;
reg [7:0] mem[79:0]; //velièina memorije
always@(Adr_in)
begin
if(CLK_RW == 1)
begin
mem[Adr_in] = Adr_in;
end
else if(CLK_RW == 0)
begin
DDR_out = mem[Adr_in];
end
end
endmodule
module CGROM(DDR_in_adr, DDR_out, PSC_out, en_read, CLK);
input [7:0] DDR_in_adr;//ulaz
input en_read,CLK;//
output[7:0] DDR_out;
output[4:0] PSC_out;// izlaz - paralelno serijski konverter
reg [4:0] mem [1983:0];
// memorija velièine 9920 bita
mem[1]=0;
mem[9]=5'h11;//H
mem[10]=5'h11;
mem[11]=5'h11;
mem[12]=5'h1F;
mem[13]=5'h11;
mem[14]=5'h11;
mem[15]=5'h11;
mem[16]=5'h00;
mem[17]=5'h1E;//D
mem[18]=5'h11;
mem[19]=5'h11;
mem[20]=5'h11;
mem[21]=5'h11;
mem[22]=5'h11;
mem[23]=5'h1E;
mem[24]=5'h00;
mem[25]=5'h02;//4
mem[26]=5'h06;
mem[27]=5'h0A;
mem[28]=5'h12;
mem[29]=5'h1F;
mem[30]=5'h02;
mem[31]=5'h02;
mem[32]=5'h00;
mem[33]=5'h02;//4
mem[34]=5'h06;
mem[35]=5'h0A;
mem[36]=5'h12;
mem[37]=5'h1F;
mem[38]=5'h02;
mem[39]=5'h02;
mem[40]=5'h00;
mem[41]=5'h1F;//7
mem[42]=5'h11;
mem[43]=5'h01;
mem[44]=5'h02;
mem[45]=5'h04;
mem[46]=5'h08;
mem[47]=5'h08;
mem[48]=5'h00;
mem[49]=5'h0E;//8
mem[50]=5'h11;
mem[51]=5'h11;
mem[52]=5'h0E;
mem[53]=5'h11;
mem[54]=5'h11;
mem[55]=5'h0E;
mem[56]=5'h00;
mem[57]=5'h0E;//0
mem[58]=5'h11;
mem[59]=5'h13;
mem[60]=5'h15;
mem[61]=5'h19;
mem[62]=5'h11;
mem[63]=5'h0E;
mem[64]=5'h00;
endmodule
module Timing_Generator(TG_out_40, TG_out_16, TG_out);
output [6:0]TG_out_40;
output [3:0]TG_out_16;
output [6:0]TG_out;
endmodule
Defton said:Can u help me to start?
Defton said:Impossible, it's hard, we cant do it without precise details in datasheet..
As I already mentioned: "A datasheet is not intended as a chip construction manual." I fear, you basically have to re-invent the chip for your project, I don't think that you'll find functional or even synthesizable HDL code for it. But I'm almost confident, that the prject can be done.we cant do it without precise details in datasheet
FvM said:I fear, you basically have to re-invent the chip for your project, I don't think that you'll find functional or even synthesizable HDL code for it. But I'm almost confident, that the prject can be done.we cant do it without precise details in datasheet
module HD44780(
RS,
RW,
E,
Seg_out,
Com_out,
Data_Bus,
CLK, CLK_REDAK,
EN_READ,
CLK_SEG_OUT);
input
RS, //mpu
RW, //mpu
E, //mpu
CLK,
CLK_REDAK,
EN_READ,
CLK_SEG_OUT;
//taktni signali
input [7:0]Data_Bus;//ulazne naredbe 8bitne;
output[39:0]Seg_out;//segmetni signali - stupci
output[7:0]Com_out;//common signali - redci
reg[39:0]Seg_out;
//reg[7:0]Com_out;
//reg[7:0]Adresa_znaka;
//reg[2:0]Adresa_retka;
reg[7:0]data_reg;//podatkovni registar
reg[7:0]instr_reg;//instrukcijski registar
reg[39:0]shift_reg;//shift registar za segmente signale
reg[39:0]latch;//latch koji sprema sadr¾aj shift registra za seg_signale
// reg[7:0]shift_reg8;
reg[2:0]Adress_counter;
reg Busy_Flag;
initial instr_reg = 0;
/////DEFINIRANJE INTRUKCIJA//////
always@(posedge E or RS or RW)
begin
if(RS==0 && RW ==0)
begin
instr_reg = Data_Bus;
end
end
/////////DDRAM////////////////
reg [7:0] DDRAM[79:0];
///////CGROM/////////
reg [4:0] mem [55:0];
always@(CLK)
begin
mem[0]=5'h00;//space
mem[1]=5'h00;
mem[2]=5'h00;
mem[3]=5'h00;
mem[4]=5'h00;
mem[5]=5'h00;
mem[6]=5'h00;
mem[7]=5'h00;
mem[8]=5'h11;//H
mem[9]=5'h11;
mem[10]=5'h11;
mem[11]=5'h1F;
mem[12]=5'h11;
mem[13]=5'h11;
mem[14]=5'h11;
mem[15]=5'h00;
mem[16]=5'h1E;//D
mem[17]=5'h11;
mem[18]=5'h11;
mem[19]=5'h11;
mem[20]=5'h11;
mem[21]=5'h11;
mem[22]=5'h1E;
mem[23]=5'h00;
mem[24]=5'h02;//4
mem[25]=5'h06;
mem[26]=5'h0A;
mem[27]=5'h12;
mem[28]=5'h1F;
mem[29]=5'h02;
mem[30]=5'h02;
mem[31]=5'h00;
mem[32]=5'h1F;//7
mem[33]=5'h11;
mem[34]=5'h01;
mem[35]=5'h02;
mem[36]=5'h04;
mem[37]=5'h08;
mem[38]=5'h08;
mem[39]=5'h00;
mem[40]=5'h0E;//8
mem[41]=5'h11;
mem[42]=5'h11;
mem[43]=5'h0E;
mem[44]=5'h11;
mem[45]=5'h11;
mem[46]=5'h0E;
mem[47]=5'h00;
mem[48]=5'h0E;//0
mem[49]=5'h11;
mem[50]=5'h13;
mem[51]=5'h15;
mem[52]=5'h19;
mem[53]=5'h11;
mem[54]=5'h0E;
mem[55]=5'h00;
end
////////ZA CITANJE IZ CGROM-a//////////
reg[10:0]adr;
reg[2:0]redak;
reg ispisano;
reg[39:0]redak_shift0;
reg[39:0]redak_shift1;
reg[39:0]redak_shift2;
reg[39:0]redak_shift3;
reg[39:0]redak_shift4;
reg[39:0]redak_shift5;
reg[39:0]redak_shift6;
reg[39:0]redak_shift7;
integer i;
always@(negedge CLK)
begin
if(instr_reg==0 && RS == 1 && RW ==0)
begin
data_reg=Data_Bus;
DDRAM[data_reg] = data_reg;
end
if(instr_reg == 8'b00000001 && RS==1 && RW == 0)
begin
for(i=1; i<=8;i=i+1)
begin
data_reg = 8'h00;
end
Busy_Flag = 1;
DDRAM[data_reg] = data_reg;
end
if(EN_READ == 1 && ispisano == 0)
begin
adr ={data_reg,redak};
shift_reg=shift_reg<<5;
shift_reg[4:0]= mem[adr];
if(redak == 3'b111)
begin
ispisano = 1;
redak = 3'b000;
end
else
redak =redak + 1;
end
else
begin
ispisano=0;
redak=0;
end
end
always@(ispisano)
begin
if (ispisano==1)
latch = shift_reg;
end
always@(posedge CLK_REDAK)
begin
if(CLK_REDAK==1);
begin
redak_shift0 = redak_shift0<<5 ;
redak_shift1 = redak_shift1<<5 ;
redak_shift2 = redak_shift2<<5 ;
redak_shift3 = redak_shift3<<5 ;
redak_shift4 = redak_shift4<<5 ;
redak_shift5 = redak_shift5<<5 ;
redak_shift6 = redak_shift6<<5 ;
redak_shift7 = redak_shift7<<5;
redak_shift0[4:0] = latch[39:35];
redak_shift1[4:0] = latch[34:30];
redak_shift2[4:0] = latch[29:25];
redak_shift3[4:0] = latch[24:20];
redak_shift4[4:0] = latch[19:15];
redak_shift5[4:0] = latch[14:10];
redak_shift6[4:0] = latch[9:5];
redak_shift7[4:0] = latch[4:0];
end
end
reg[3:0]redak_counter;//broojaè redak za COM Signale...
assign Com_out = (Seg_out == redak_shift0)? 8'b00000001:// com_demux_
(Seg_out == redak_shift1)? 8'b00000010:
(Seg_out == redak_shift2)? 8'b00000100:
(Seg_out == redak_shift3)? 8'b00001000:
(Seg_out == redak_shift4)? 8'b00010000:
(Seg_out == redak_shift5)? 8'b00100000:
(Seg_out == redak_shift6)? 8'b01000000: 8'b10000000;
initial redak_counter = 0;
always@(posedge CLK_SEG_OUT)
begin
if(CLK_SEG_OUT == 1 && redak_counter == 0)
begin
Seg_out = redak_shift0;
redak_counter = redak_counter + 1;
end
else if(CLK_SEG_OUT == 1 && redak_counter == 1)
begin
Seg_out = redak_shift1;
redak_counter = redak_counter + 1;
end
else if(CLK_SEG_OUT == 1 && redak_counter == 2)
begin
Seg_out = redak_shift2;
redak_counter = redak_counter + 1;
end
else if(CLK_SEG_OUT == 1 && redak_counter == 3)
begin
Seg_out = redak_shift3;
redak_counter = redak_counter + 1;
end
else if(CLK_SEG_OUT == 1 && redak_counter == 4)
begin
Seg_out = redak_shift4;
redak_counter = redak_counter + 1;
end
else if(CLK_SEG_OUT == 1 && redak_counter == 5)
begin
Seg_out = redak_shift5;
redak_counter = redak_counter + 1;
end
else if(CLK_SEG_OUT == 1 && redak_counter == 6)
begin
Seg_out = redak_shift6;
redak_counter = redak_counter + 1;
end
else if(CLK_SEG_OUT == 1 && redak_counter == 7)
begin
Seg_out = redak_shift7;
redak_counter = 0;
end
//redak_counter=redak_counter + 1;
end
//Adress_Co1unter
endmodule
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?