ascii - Printing characters to LCD - Verilog HDL -
i have question regarding printing character lcd screen.
i using altera de1-soc 5csema5f31c6n , lt24 terasic lcd.
i have question regarding printing letters in row on lcd.
i relying on x , y counter raster across screen, starting @ (0,0) upper left corner of screen. incrementing x way end of row, , once reached end, reset x 0, increment y , continue counting x again until end of screen
i creating arrays print character values (8x8 px)
the long array concatenates 'each row of pixels' characters, , whilst counter rastered across screen pixels each character print lcd.
eg. row0 - print first row of pixels characters. row1 - print second row of pixels characters.
however, when try print 2 characters, order of characters being printed reversed [from origin (0,0)]
e.g. if want print 'i' 'm'. 'm' , 'i' in order.
when try print 3 characters, no characters show @ all!
i struggling understand why case, counter values used test current bit of character , draw pixel
any appreciated.
i have basic verilog understanding, comfortable c programming
thank you,
code snippets below.
////////////////////////////// code //////////////////////////////////////////// reg [0] totalchardata [23:0]; // pixel row0 reg [1] totalchardata [23:0]; // pixel row1 reg [2] totalchardata [23:0]; // pixel row2 reg [3] totalchardata [23:0]; // pixel row3 reg [4] totalchardata [23:0]; // reg [5] totalchardata [23:0]; // reg [6] totalchardata [23:0]; // reg [7] totalchardata [23:0]; // pixel row 7 // character ‘i' totalchardata[7][7:0] = 8'b11111111; totalchardata[6][7:0] = 8'b11111111; totalchardata[5][7:0] = 8'b00111100; totalchardata[4][7:0] = 8'b00111100; totalchardata[3][7:0] = 8'b00111100; totalchardata[2][7:0] = 8'b00111100; totalchardata[1][7:0] = 8'b11111111; totalchardata[0][7:0] = 8'b11111111; // character ‘m' totalchardata[7][15:8] = 8'b11100111; totalchardata[6][15:8] = 8'b11101111; totalchardata[5][15:8] = 8'b11111111; totalchardata[4][15:8] = 8'b11111111; totalchardata[3][15:8] = 8'b11010011; totalchardata[2][15:8] = 8'b11000011; totalchardata[1][15:8] = 8'b11000011; totalchardata[0][15:8] = 8'b11000011; // character ‘e' totalchardata[7][23:16] = 8'b11111111; totalchardata[6][23:16] = 8'b11111111; totalchardata[5][23:16] = 8'b11100000; totalchardata[4][23:16] = 8'b11111111; totalchardata[3][23:16] = 8'b11111111; totalchardata[2][23:16] = 8'b11100000; totalchardata[1][23:16] = 8'b11111111; totalchardata[0][23:16] = 8’b11111111; // x counter @ (posedge clock or posedge resetapp) begin if (resetapp) begin xaddr <= 8'b0; end else if (pixelready) begin if (xaddr < (width-1)) begin xaddr <= xaddr + 8'd1; end else begin xaddr <= 8'b0; end end end // y counter @ (posedge clock or posedge resetapp) begin if (resetapp) begin yaddr <= 9'b0; end else if (pixelready && (xaddr == (width-1))) begin if (yaddr < (height-1)) begin yaddr <= yaddr + 9'd1; end else begin yaddr <= 9'b0; end end end // draw characters lcd @ (posedge clock or posedge resetapp) begin if (resetapp) begin pixeldata[15:0] <= 16'h0000; ; // wipe full screen background end else begin // whilst bitton held, make blue if ((xaddr>=0) && (xaddr<24) && (yaddr>=0) && (yaddr<8))begin // draw complete row of pixels characters in line if ((totalchardata[yaddr][xaddr] == 1'b1))begin // test current bit using counters pixeldata[15:0] <= 16'hffe0; // yellow - draw pixel if current bit 1 defined end else begin pixeldata[15:0] <= 16'h0000; end // else end else begin pixeldata[15:0] <= 16'h0000; // black screen end end end
i @ how define registers. based on how accessing them in rtl, expected them defined
reg [23:0] total_char_data [0:7]
this in 1 line trying in 8, notice [23:0] on left side (packed array) , [0:7] on right (unpacked array) in definition. when done this, think existing assignments work.
based on though, don't know how getting 2 characters show up. have imagined looking @ it, 1 character appear, within 8x8 window. don't suppose have interesting warnings in compile things like, "outside of bit range"?
Comments
Post a Comment