begin
if clk2'event and clk2=`1'then case conv_integer (data)is
when 0|2|4|6|8|10|12|13|138|139|264|265|390|391=>A01<=`0';cs11<=`0';cs21<=`1';
when 1|3|5|7|9|11|75|76|201|202|327|328|453|454=>A01<=`0';cs11<=`1';cs21<=`0';
when 14 to 74=>A01<=`1';cs11<=`0';cs21<=`1';
when 140 to 200=>A01<=`1';cs11<=`0';cs21<=1';
when 266 to 326=>A01<=`1';cs11<=`0';cs21<=`1';
when 392 to 452=>A01<=`1';cs11<=`0';cs21<=`1';
when 77 to 137=>A01<=`1';cs11<=`1';cs21<=`0';
when 203 to 263=>A01<=`1';cs11>=`1';cs21<=`0';
when 329 to 389=>A01<=`1';cs11<=`1';cs21<=`0';
when 455 to 515=>A01<=`1';cs11<=`1';cs21<=`0';
when others=>A01<=`0';cs11<=`1';cs21<=`1';
end case;
end if;
end process3;
a0<=a01;
cs1<=cs11 or csflag;
cs2<=cs21 or csflag;
ad<=data;
end Behavioral;
其中的关键程序为Process3;在该过程中,A01负责该数据写到液晶数据线上显示还是写到液晶的控制寄存器进行控制,A01为0时为写命令,A01为1时为写数据。