Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

Straight line isn't a straight line

hi

I'm using a CycloneII EP2C5T144C8N with QuartusII v11.1, trying to create a sweeping analog clock second hand in VGA.

My first attempt was at 640x480 with a clock 'hand' 160 pixels long. I scaled down the 50MHz clock to 25Mhz and created ROM tables of 160 entries for the coordinates of the straight lines for seconds from 1-7, 23-29..etc , where dy>dx and 8-14, 16-22,..etc, where dy<dx. This worked fine, with good straight lines, but the 'clock' wasn't exactly circular. I read somewhere that this was because the native resolution of my screen wasn't 640x480.

The native resolution is 1280x1024 @ 75Hz, so I used one of the PLL's to generate a 135MHz clock. I extended the clock hand length to 300 Pixels, and amended the ROM tables accordingly. Now I get good clean lines for seconds 1-7, 23-29, etc, for which dy>dx, but the other lines, 8-14 seconds, 16-22,..etc, are 'dirty', in that the pixels don't form a straight line but are clustered loosely around what the straight line should be, some close to the proper line, some as far as 1-2 cm away from it.

I've checked the ROM tables and changed the hand length back to 160 pixels, but I still can't get a straight line for those lines where dy<dx, but can for dy>dx. I've exhausted my limited knowledge of VHDL trying to sort it out and can't find anything similar on the interne, so any pointers would be gratefully received.Or should I try to implement the hands using M4K blocks instead (something else I haven't tried to use yet) ?

regards
No RepliesBe the first to reply