如何使用handel-C和DE2-115 FPGA板显示多个对象

时间:2013-10-05 23:33:45

标签: fpga

下面是我的Handel-C代码,它可以通过FPGA VGA在显示器上显示球。但是当我尝试在显示器中显示一个球和一个盒子时,它只显示第一个,如果我禁用球,那么我可以显示一个盒子。

球和盒子的行为相似,只是大小和初始位置不同。

有谁知道那里发生了什么?

#include <stdlib.hch>
#include "tpad.hch"
#include "ball.hch"

set family = AlteraCycloneIII; /* Really a Cyclone IV */
set part = "EP4CE115F29C7";
interface bus_in (unsigned 1 pin) clock_pin () with {data = {"Y2"}};
interface altpll (unsigned 5 clk with {clockport = 1})
pll (unsigned 2 inclk = 0 @ clock_pin.pin) 

with {
busformat = "B[N:0]",

properties = {

{"bandwidth_type", "AUTO"},
{"clk0_divide_by", "5"},
{"clk0_duty_cycle", "50"},
{"clk0_multiply_by", "4"},
{"clk0_phase_shift", "0"},
{"compensate_clock", "CLK0"},
{"inclk0_input_frequency", "20000"},
{"intended_device_family", "Cyclone IV E"},
{"lpm_hint", "CBX_MODULE_PREFIX=pll"},
{"lpm_type", "altpll"},
{"operation_mode", "NORMAL"},
{"pll_type", "AUTO"},
{"port_clk0", "PORT_USED"},
{"width_clock", "5"}},
bind = 1};

set clock = internal pll.clk[0];

void main( void ) {
    lcd_data lcd;
par {
    lcd_data lcd;
    Ball ball, box;

    initialise_ball( ball ); // Initialise ball structure before starting
    initialise_box (box);
    par {
        lcd_driver( lcd ); // Run display driver in parallel

            while (lcd.v_ena) // While vertical enable is true
              do par{
            display_ball( lcd, ball );  // display ball
            display_box (lcd, box);

//            update_ball( ball ); // update ball position

//            while (!lcd.v_ena) delay; // While vertical enable is false
            } while (1);
        }
    }
}

0 个答案:

没有答案