UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
2,050 Views
Registered: ‎09-21-2016

Display Frame by frame by pressing button

Hi everyone,

I want to make a camera system by which I can get one frame output whenever I will press button. Actually, button will work as a trigger here. By enabling the trigger, I will have one frame output.

Right now I have this kind of setup.

 

20.JPG

From the figure you can see, by pressing the push_btn_r (green line), the interrupt will be enabled. And in the handler function, I make the reset '0' for the for the few moments. Here is the code:

void BTN_Intr_Handler(void *InstancePtr)
{
	// Disable GPIO interrupts
	XGpio_InterruptDisable(&BTNInst, BTN_INT);
	// Ignore additional button presses
	if ((XGpio_InterruptGetStatus(&BTNInst) & BTN_INT) !=BTN_INT) {
	return;
	}
	btn_value = XGpio_DiscreteRead(&BTNInst, 1);
	// Increment counter based on button value
	// Reset if center button pressed
	if(btn_value != 0)
	{
		led_data = 0;
		xil_printf("Led value =%d\r\n",led_data);
		XGpio_DiscreteWrite(&LEDInst, 1, led_data);

		for (int i=0; i<500000;i++);

		led_data = 1;
		xil_printf("Led value =%d\r\n",led_data);
		XGpio_DiscreteWrite(&LEDInst, 1, led_data);
	}
	else
	{
		led_data = 1;
		xil_printf("Led value =%d\r\n",led_data);
		XGpio_DiscreteWrite(&LEDInst, 1, led_data);
	}

	(void) XGpio_InterruptClear(&BTNInst, BTN_INT);
	// Enable GPIO interrupts
	XGpio_InterruptEnable(&BTNInst, BTN_INT);
}

By pressing each button, I don?셳 have output right now. In my code, I gave a delay when a button is pressed. The delay is near about 100 ms. So that I can see the output for a moment. Sometimes, I have output sometimes I don?셳. Why is this happening?

Besides, my intention is by pressing button time I will see one frame output at the monitor until I press the button for the next time. How may I have this kind of system?

My design currently contains:

Sensor --> video_in --> VDMA --> video_processing IPs --> video_out --> HDMI

I am not expecting exact answer but any kind of suggestion will be very helpful.

Thank you

Rappy Saha

0 Kudos
1 Reply
Teacher muzaffer
Teacher
2,007 Views
Registered: ‎03-31-2012

Re: Display Frame by frame by pressing button

@rappysaha you need to debounce the output of button properly before you use it as an interrupt source. Mechanical buttons behave in a funny way when pressed and released (you get many presses and releases with very short pulses etc) so you are really not getting anything meaningful right now. Clean up the button output and you will see more consistent results.

 

- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos