billgas

Members
  • Content Count

    3
  • Joined

  • Last visited

About billgas

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. hello @BogdanVanca, thank you a lot! i check my teraterm setting about CR+LF and baud rate,but it just cannot work well, maybe it really suffers from buffer overflow. I will try fgets(). by the way, if i create my own commands enumeration, do i need to set teraterm as CR?
  2. hello, I practice to use vivado 2018.2 to create two AXI GPIOs like the first picture. I could use C program to pass the ON/OFF from switchs to leds;however, the XGpio_DiscreteRead() is always blocked by gets() when i want to use gets() to get cmd,and write data to leds according cmd. The following is my C code.Please introduce me to solve the problem. Thank you a lot. #include "xparameters.h" #include "xgpio.h" #include <stdio.h> #include <stdlib.h> #include "sleep.h" int main(){ XGpio output,input; /* SW &LED Instance */ int button_data=0x00; int switch_data=0; int led_value = 0; int i=0; char cmd[4]; XGpio_Initialize(&output, XPAR_AXI_GPIO_1_DEVICE_ID); XGpio_SetDataDirection(&output, 1, 0x0); XGpio_Initialize(&input, XPAR_AXI_GPIO_0_DEVICE_ID); XGpio_SetDataDirection(&input, 1, 0xF); while(1) { i++; printf("This the %d time run the while loop\n\r",i); printf("Enter Command: \n\r"); gets(cmd); switch_data = XGpio_DiscreteRead(&input, 1); printf("switch_data = %d\n\r",switch_data); led_value = switch_data+1; XGpio_DiscreteWrite(&output, 1, led_value); printf("data wrtie over"); printf("=========================================="); usleep(20000); } return 0; }