xgpio_DiscreteRead

Hi Everybody

I have this problem with my Microblaze. No mater what I do I can not read a simple data from GPIO (DIP Switches), that are on my Spartan 3E Starter Kit Board

Here is my code that come out on RS232 terminal with "0" value:

/////////////////////////////////////// // #include definition // /////////////////////////////////////// #include "stdio.h" #include "xgpio.h" #include "xuartlite_l.h" #include "xbasic_types.h" ///////////////////////////////////////

#define UART_ADDRESS 0x40600000 //XPAR_RS232_UART_BASEADDR

#define LEDS_DEVICE_ID 0x40000000 //LEDS BASE ADDRESS #define LEDS_DATA_DIRECTION 0x00000000 //LEDS DATA DIR #define LEDS_CHANNEL 1 //LEDS CHANNEL

#define SWITCHES_DEVICE_ID 0x40020000 //SWITCHES BASE ADDRESS #define SWITCHES_DATA_DIRECTION 0xFFFFFFFF #define SWITCHES_CHANNEL 1

/////////////////////////////////////// // MAIN // ///////////////////////////////////////

int main(void) { print("\r\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); print("-- BEGIN --\r\n\n");

XStatus status; //Status variable for initialization

print("Initialize Switches ..."); XGpio Switches; status = XGpio_Initialize(&Switches, SWITCHES_DEVICE_ID); XGpio_SetDataDirection(&Switches, SWITCHES_CHANNEL, SWITCHES_DATA_DIRECTION); if (status == XST_SUCCESS) { print(" [ OK ]\r\n"); } else { print(" [FAIL]\r\n"); return -1; }

int gpioData; while (1) { print("Read Data "); gpioData = XGpio_DiscreteRead(&Switches, SWITCHES_CHANNEL); xil_printf(" >> %D\n\r", gpioData); }

print("\r\n\n-- END --"); } ///////////////////////////////////////

please help me...

Reply to
jerzy.zielinski
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.