Forum Discussion
Altera_Forum
Honored Contributor
15 years agoThe answer is in these two pieces of code:
else if (avs_chipselect & avs_write)
begin
case (avs_address)
0: coe_e <= avs_writedata;
1: coe_rw <= avs_writedata;
2: coe_rs <= avs_writedata;
3: coe_data_o <= avs_writedata;
endcase
endand if (avs_chipselect & avs_read)
begin
if (avs_address == 3)
readdata_r <= coe_data_i;
else
readdata_r <= 8'b0;
end
else
readdata_r <= 8'b0;
assign avs_readdata = {24'b0, readdata_r}; Writing on the first 3 addresses changes one signal to the lcd controller, controlled by the LSB of your data word (i.e. write "0" to drive the signal low and "1" to drive it high). Address LCD12864_BASE controls E, LCD12864_BASE+4 controls RW, and LCD12864_BASE +8 controls RS. On the last address (LCD12864_BASE+12), you control the data written to the controller with the low 8 bits. Reading on the first 3 addresses returns 0, and reading from LCD12864_BASE+12 returns you the word written by the LCD controller in the low 8 bits. The component uses 32-bit data registers for read and write, and has 4 registers. That's why the span is 4*4=16. This is also why you need to increase the address in steps of 4 to access each register.