点阵显示程序.docx
《点阵显示程序.docx》由会员分享,可在线阅读,更多相关《点阵显示程序.docx(16页珍藏版)》请在冰豆网上搜索。
点阵显示程序
16*16点阵显示程序
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_arith.all;
useieee.std_logic_unsigned.all;
--------------------------------------------------------------------
entitydotis
port(data_in:
instd_logic_vector(7downto0);--databus
clk:
instd_logic;--时钟输入
dotc:
outstd_logic_vector(15downto0);--点阵列控制
dotr:
outstd_logic_vector(15downto0)--点阵行显示
);
enddot;
--------------------------------------------------------------------
architecturebehaveofdotis
signalcdount:
std_logic_vector(3downto0);
begin
process(clk)--显示时序控制
begin
ifclk'eventandclk='1'then
ifcdount<15then
cdount<=cdount+1;
else
cdount<="0000";
endif;
endif;
endprocess;
process(cdount)
begin
casecdountis
when"0000"=>dotc<="0000000000000001";--列选择(lg7088Ah)
when"0001"=>dotc<="0000000000000010";
when"0010"=>dotc<="0000000000000100";
when"0011"=>dotc<="0000000000001000";
when"0100"=>dotc<="0000000000010000";
when"0101"=>dotc<="0000000000100000";
when"0110"=>dotc<="0000000001000000";
when"0111"=>dotc<="0000000010000000";
when"1000"=>dotc<="0000000100000000";
when"1001"=>dotc<="0000001000000000";
when"1010"=>dotc<="0000010000000000";
when"1011"=>dotc<="0000100000000000";
when"1100"=>dotc<="0001000000000000";
when"1101"=>dotc<="0010000000000000";
when"1110"=>dotc<="0100000000000000";
when"1111"=>dotc<="1000000000000000";
whenothers=>dotc<="0000000000000000";
endcase;
ifdata_in="01101001"then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示1
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111111";
when"0100"=>dotr<="1111111111111111";
when"0101"=>dotr<="1111111111111111";
when"0110"=>dotr<="0111111111111101";
when"0111"=>dotr<="0000000000000000";
when"1000"=>dotr<="0111111111111111";
when"1001"=>dotr<="1111111111111111";
when"1010"=>dotr<="1111111111111111";
when"1011"=>dotr<="1111111111111111";
when"1100"=>dotr<="1111111111111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="1111111111111111";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in="01110010"then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示2
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111111";
when"0100"=>dotr<="1111111111111111";
when"0101"=>dotr<="1111111111110111";
when"0110"=>dotr<="1111001111111011";
when"0111"=>dotr<="1111010000011101";
when"1000"=>dotr<="1111011111101011";
when"1001"=>dotr<="1111011111110111";
when"1010"=>dotr<="1111011111111111";
when"1011"=>dotr<="1111111111111111";
when"1100"=>dotr<="1111111111111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="1111111111111111";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in="01111010"then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示3
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111111";
when"0100"=>dotr<="1111111111111111";
when"0101"=>dotr<="1111011111110111";
when"0110"=>dotr<="1111011110110111";
when"0111"=>dotr<="1111101101011011";
when"1000"=>dotr<="1111110011100011";
when"1001"=>dotr<="1111111111111111";
when"1010"=>dotr<="1111111111111111";
when"1011"=>dotr<="1111111111111111";
when"1100"=>dotr<="1111111111111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="1111111111111111";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in=107then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示4
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111001111";
when"0100"=>dotr<="1111111111010111";
when"0101"=>dotr<="1111111111011011";
when"0110"=>dotr<="1111111111011101";
when"0111"=>dotr<="1000000000000000";
when"1000"=>dotr<="1111111111011111";
when"1001"=>dotr<="1111111111011111";
when"1010"=>dotr<="1111111111011111";
when"1011"=>dotr<="1111111111111111";
when"1100"=>dotr<="1111111111111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="1111111111111111";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in=115then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示5
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111111";
when"0100"=>dotr<="1111111111111111";
when"0101"=>dotr<="1111111111000001";
when"0110"=>dotr<="1011111110111101";
when"0111"=>dotr<="1101111101111101";
when"1000"=>dotr<="1110111011111101";
when"1001"=>dotr<="1111010111111101";
when"1010"=>dotr<="1111101111111101";
when"1011"=>dotr<="1111111111111111";
when"1100"=>dotr<="1111111111111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="1111111111111111";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in=116then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示6
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111111";
when"0100"=>dotr<="1111111111111111";
when"0101"=>dotr<="1111111111111111";
when"0110"=>dotr<="1111000000000111";
when"0111"=>dotr<="1110110111111011";
when"1000"=>dotr<="1101110111111101";
when"1001"=>dotr<="1101110111111111";
when"1010"=>dotr<="1110001111111111";
when"1011"=>dotr<="1111111111111111";
when"1100"=>dotr<="1111111111111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="1111111111111111";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in=x"6c"then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示7
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111101";
when"0100"=>dotr<="1111111111111101";
when"0101"=>dotr<="1111111111111101";
when"0110"=>dotr<="1111111111111101";
when"0111"=>dotr<="1111111111111101";
when"1000"=>dotr<="1111111111111101";
when"1001"=>dotr<="1000000000000001";
when"1010"=>dotr<="1111111111111111";
when"1011"=>dotr<="1111111111111111";
when"1100"=>dotr<="1111111111111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="1111111111111111";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in=x"75"then
casecdountis
when"0000"=>dotr<="111111*********1";--列显示显示8
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111111";
when"0100"=>dotr<="1111110111110111";
when"0101"=>dotr<="1111101011101011";
when"0110"=>dotr<="1111011101011101";
when"0111"=>dotr<="1110111100111110";
when"1000"=>dotr<="1111011011011101";
when"1001"=>dotr<="1111110111101011";
when"1010"=>dotr<="1111111111110111";
when"1011"=>dotr<="1111111111111111";
when"1100"=>dotr<="1111111111111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="1111111111111111";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in=x"7d"then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示9
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111111";
when"0100"=>dotr<="1111111111100111";
when"0101"=>dotr<="1111111111011011";
when"0110"=>dotr<="1110111110111101";
when"0111"=>dotr<="1111011111011011";
when"1000"=>dotr<="1111100000000111";
when"1001"=>dotr<="1111111111111111";
when"1010"=>dotr<="1111111111111111";
when"1011"=>dotr<="1111111111111111";
when"1100"=>dotr<="1111111111111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="1111111111111111";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in=x"70"then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示0
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111111";
when"0100"=>dotr<="1111111111111111";
when"0101"=>dotr<="1111110000111111";
when"0110"=>dotr<="1111011111011111";
when"0111"=>dotr<="1110111111101111";
when"1000"=>dotr<="1101111111110111";
when"1001"=>dotr<="1110111111110111";
when"1010"=>dotr<="1111011111101111";
when"1011"=>dotr<="1111101111011111";
when"1100"=>dotr<="1111110000111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="111111*********1";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in=x"71"then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示.
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111111";
when"0100"=>dotr<="1111111111111111";
when"0101"=>dotr<="1111111111111111";
when"0110"=>dotr<="1111111000011111";
when"0111"=>dotr<="1111111000011111";
when"1000"=>dotr<="1111111000011111";
when"1001"=>dotr<="1111111111111111";
when"1010"=>dotr<="1111111111111111";
when"1011"=>dotr<="1111111111111111";
when"1100"=>dotr<="1111111111111111";
when"1101"=>dotr<="1111111111111111";
when"1110"=>dotr<="1111111111111111";
when"1111"=>dotr<="1111111111111111";
whenothers=>dotr<="1111111111111111";
endcase;
elsifdata_in=x"79"then
casecdountis
when"0000"=>dotr<="1111111111111111";--列显示显示+
when"0001"=>dotr<="1111111111111111";
when"0010"=>dotr<="1111111111111111";
when"0011"=>dotr<="1111111111111111";
when"0100"=>dotr<="1111111101111111";
when"0101"=>dotr<="1111111101111111