ECE 448: Lab 4 VGA Display. Bouncing Ball.. Organization and Grading.

23
ECE 448: Lab 4 VGA Display. Bouncing Ball.

Transcript of ECE 448: Lab 4 VGA Display. Bouncing Ball.. Organization and Grading.

ECE 448: Lab 4

VGA Display. Bouncing Ball.

Organization and Grading

Flexibility in the Second Part of the Semester

• You can work on all lab assignments from Part II of the course

either individually or in groups of two students.

• The number of required and bonus tasks, as well as

the grading scheme will be different for individuals and

the groups of two.

• In case of the group work, both students are expected to

be intimately familiar with the entire solution to the given

lab assignment and the entire lab report.

This knowledge will be verified during the experiment

demonstration and the same grade will be applied to

the entire team.

Flexibility in the Second Part of the Semester

Lab 4: VGA display (2 weeks) – 6 points

Lab 5: DSP & FPGA Embedded Resources (2 weeks) – 6 points

Lab 6: PicoBlaze & Serial Communication (3 weeks) – 6 points

Lab 6a: Logic Analyzer (in class) – 2 points

Lab 4: VGA display (3 weeks) – 6 points

Lab 5: DSP & FPGA Embedded Resources (4 weeks) – 6 points

Lab 6a: Logic Analyzer (in class) – 2 points

Schedule A:

Schedule B:

Total: 20 points

Total: 14 points

VGA Background

Video Graphic Array (VGA)• Resolution: 640x480• Display: 16 colors (4 bits), 256 colors (8 bits)• Refresh Rate: 25Hz, 30Hz, 60Hz (frames / second)• RGB: Red, Green and Blue colors

Horizontal TraceHorizontal Flyback

Vertical Flyback

0 639

479

0

VGA Monitor

VGA Control Signal Timing

Resolution640x480

32 us

30.08 us

26.24 us

25.6 us

32 us

30.08 us

26.24 us

32 us

30.08 us

15.36 ms

15.68 ms

16.8ms

15.744 ms

VGA Control Signal Timing

Resolution640x480

32 us

30.08 us

26.24 us

640 clock cycles

32 us

30.08 us

656 clock cycles

800 clock cycles

752 clock cycles

480 lines

490 lines

525 lines

492 lines

Frequency 25Mhz

VGA 15 Pin

PINs on BoardNET "HS" LOC = "J14" | DRIVE = 2 | PULLUP ; NET "VS" LOC = "K13" | DRIVE = 2 | PULLUP ;NET "OutRed<2>" LOC = "F13" | DRIVE = 2 | PULLUPNET "OutRed<1>" LOC = "D13" | DRIVE = 2 | PULLUP ; NET "OutRed<0>" LOC = "C14" | DRIVE = 2 | PULLUP ; We do not

use this pin. NET "OutGreen<2>" LOC = "G14" | DRIVE = 2 | PULLUP;NET "OutGreen<1>" LOC = "G13" | DRIVE = 2 | PULLUP ;NET "OutGreen<0>" LOC = "F14" | DRIVE = 2 | PULLUP ; We do not

use this pin.NET "OutBlue<2>" LOC = "J13" | DRIVE = 2 | PULLUP ; NET "OutBlue<1>" LOC = "H13" | DRIVE = 2 | PULLUP ;

Introduction to Lab 4

Task 1: Displaying the ball(2pts single person, 1.5pts teams)

0 639

479

0

(639,479)

• Draw a circle (ball) in the center of the screen

Task 1: Displaying the ball(2pts single person, 1.5pts teams)

• Circle Fill: implements equation [(X-X0)2+(Y-Y0)2< R2]• Color Generator: Selects colors for ball and background• VGA Controller: Sync generator (may use Digilent)

VGAController

ColorGenerator

H COUNT

V COUNT

H SYNC

V SYNC

H SYNC

V SYNC

RED

GREEN

BLUE

RED

GREEN

BLUE

FILL

2

2

2

11

11

11

11

X

Y

X0

Y0320

240

FILL

BLANK

BLANK

CIRCLEFILL

X

Y

X0

Y0

FILL

X0

Y0

X

Y

Task 2: Moving the ball(2pts single person, 1.5pts teams)

• Move the ball using the buttons• 0 = up 1 = down 2 = left 3 = right

Task 2: Moving the ball(2pts single person, 1.5pts teams)

• Manual Count: [NEXT = PREV +/- 4*(STEP+1)] • Limit NEXT to within the screen boundary (use generic)

MANUALCOUNT(X-AXIS)

H COUNT

V COUNT

FILL

LEFT

RIGHT

STEP

BUTTON(2)

BUTTON(3)

SWITCH(1:0)

MANUALCOUNT(Y-AXIS)

UP

DOWN

STEP

BUTTON(0)

BUTTON(1)

SWITCH(3:2)

11

112

2

NEXT

NEXT

PREV

PREV

CIRCLEFILL

11

11

X

Y

X0

Y0

FILL

X0

Y0

X

Y

Task 3: Bouncing the ball(2pts single person, 1.5pts teams)

20 619

459

20

(619,459)

• When the center of the ball goes beyond the boundary, the step of an appropriate counter changes sign.

Task 3: Bouncing the ball(2pts single person, 1.5pts teams)

• Clock divider: 5ms per step, pulsed output (high for 1 clock)• Automatic Count: limit out to within boundary (use generic)• Duplicate for Y-axis (Clock Divider shared by X and Y-axis)

MANUALCOUNT(X-AXIS)

LEFT

RIGHT

STEP

BUTTON(2)

BUTTON(3)

SWITCH(1:0)

AUTOMATICCOUNT(X-AXIS)

EN

STEP11

2NEXT

NEXT

11X

0

1

CLOCKDIVIDER

EN

STEP

OUT

SWITCH(7)

SWITCH(5:4)2

PREV

PREV

11

Task 4: Multiple Balls(2pts bonus single person, 1.5pts teams)

• Add a second ball• Manual and automatic mode• Different colors

20 619

459

20

(619,459)

Task 5: Change color(1.5pts bonus single person, 1 pt bonus teams)

• Change the color of the ball and the background when the ball bounces.

• The background color and the ball color must always be different

Task 6: Change Shape(1 pt bonus teams)

• Change the shape of the object every time it bounces.• Circle-to-square and square-to-circle.

20 619

459

20

(619,459)

Switch Functions• Switch[1:0] X Step Size

– manual and automatic modes

• Switch[3:2] Y Step Size– manual and automatic modes

• Switch[5:4] X,Y Step Size– automatic mode only

• Switch[6] Ball select– Manual mode only

• Switch[7] Mode– 0 = manual– 1 = automatic

Button Functions• Button[0] Up

• Button[1] Down

• Button[2] Left

• Button[3] Right