The following code was inspired by the very good example of the youtube-user “Toni T800”
I use the VGA-mode 800×600@72Hz because I can directly use the 50MHz-clock as pixel-clock. At the end a green rectangle is displayed on the monitor. Next I need to display text as well, but for that I need to learn a lot more.
libraryieee;useieee.std_logic_1164.all;useieee.numeric_std.all;ENTITY SYNC ISPORT(
R, G, B:OUTSTD_LOGIC);END SYNC;ARCHITECTURE MAIN OF SYNC ISSIGNAL HPOS:INTEGERRANGE0TO1040:=0;SIGNAL VPOS:INTEGERRANGE0TO666:=0;BEGINPROCESS(CLK)BEGINIF(rising_edge(CLK))THEN-- add 240 horiz. FP, BP, SYNC and 66 vert. FP, BP, SYNC-- display a green rectangle in the middle of the screenIF((HPOS>440AND HPOS<840AND VPOS=216)OR((HPOS=440OR HPOS=840)AND(VPOS>216AND VPOS<516))OR(HPOS>440AND HPOS<840AND VPOS=516))THEN
HSYNC<='1';ENDIF;IF(VPOS>0AND VPOS<43)THEN-- maybe 37>x<43
VSYNC<='1';ENDIF;IF((HPOS>0AND HPOS<240)OR(VPOS>0AND VPOS<66))THEN
I used the following GPIO-pins of the Altera Cyclone IV, because so I don’t need to separate the dupont cable. All pins are located together on the DE0-Nano board.
The following images shows the result after programming the FPGA.
And here you can see the connection between the FPGA and the monitor via the self-etched adaptor-board.