cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
moraali
Explorer
Explorer
2,048 Views
Registered: ‎12-06-2007

Please Help:- Pressed Push Button , But LED does not light up.

 

Good morning ,

 

   I am using EDK 9.2. Based on the coding below, when I pressed the push button, output appeared in the hyperterminal but does not light up the LED. The ucf file is correct. What should I do to rectify this problem, in such when I push the button , the partucilar LED should Light up ?

  

 

 

#include "xparameters.h"

#include "xgpio.h"

#include "xutil.h"

 

int main (void)

{

   XGpio led,Push;

   int push_check1, push_check=0;

  

   xil_printf("-- Entering main() --\r\n");

 

   XGpio_Initialize(&led,XPAR_LEDS_4BIT_DEVICE_ID);

   XGpio_Initialize(&Push,XPAR_PUSH_BUTTONS_5BIT_DEVICE_ID);

  

   XGpio_SetDataDirection(&led,1,0x0);

   XGpio_SetDataDirection(&Push,1,0xffffffff);

 

 

   xil_printf("Press center push button to exit\r\n");

   xil_printf("Any other to see corresponding LED turn ON\r\n");

  

   push_check = XGpio_DiscreteRead(&Push,1);

 

  

   while(1)

   {

      push_check1 = XGpio_DiscreteRead(&Push,1);

     

      if(push_check1 != push_check)

      {

        push_check=push_check1;

        if(push_check)

        xil_printf("Push buttons status %0x\r\n", push_check1);

      }

 

    if(push_check==0x10)

    {

       break;

    }

   

    XGpio_DiscreteWrite(&led,1,push_check); // Should light up the LED. But it does not.

   }

 

   xil_printf("-- Exiting main() --\r\n");

   return 0;

}

0 Kudos
Reply
0 Replies