From 32002000f5a74986698850cd852830455e9a9a67 Mon Sep 17 00:00:00 2001 From: sokolovstanislav Date: Thu, 27 Nov 2025 10:01:26 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=D0=BD=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=BD=D0=BE=D1=81=D1=82=D1=8C=D1=8E=20=D0=BB=D0=B8?= =?UTF-8?q?=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20?= =?UTF-8?q?=D0=B1=D1=83=D1=84=D0=B5=D1=80=20=D0=B2=20UART.=20=D0=92=D1=80?= =?UTF-8?q?=D0=BE=D0=B4=D0=B5=20=D0=B1=D1=8B=20=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B0=D0=B5=D1=82,=20=D0=BD=D0=BE=20=D1=82=D0=B0=D0=BC?= =?UTF-8?q?=20=D0=B1=D0=B5=D1=81=D0=BA=D0=BE=D0=BD=D0=B5=D1=87=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9=20=D1=86=D0=B8=D0=BA=D0=BB,=20=D0=B0=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=D1=82=D1=8C=20=D0=B2=D1=80=D0=BE=D0=B4?= =?UTF-8?q?=D0=B5=20=D0=B1=D1=8B=20=D0=B4=D0=BE=D0=BB=D0=B6=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D1=82=D0=B0=D0=BA...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XC7Z020.sdk/LEDS_test/src/main.c | 18 +++++++++--------- XC7Z020.sdk/LEDS_test/src/module_uart.c | 9 ++++++--- XC7Z020.sdk/LEDS_test/src/module_uart.h | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/XC7Z020.sdk/LEDS_test/src/main.c b/XC7Z020.sdk/LEDS_test/src/main.c index 1015620..5d4b5e4 100644 --- a/XC7Z020.sdk/LEDS_test/src/main.c +++ b/XC7Z020.sdk/LEDS_test/src/main.c @@ -40,25 +40,25 @@ int main(void) { initialization_of_UART(); while (1) { - if (count < 10000000) { + DataBuf = XGpio_DiscreteRead(&Gpio_1, 1); + if (DataBufPrev != DataBuf) { + bild_send_buffer(2, DataBuf); + terminal_uart_send(); + } + DataBufPrev = DataBuf; + if (count < 1000000) { count++; } else { if (latch) { Xil_Out32(XPAR_IP_AXI_LEDS_0_S00_AXI_BASEADDR, 0x00000000); - XGpio_DiscreteWrite(&Gpio_0, LED_CHANNEL, ~LED); + XGpio_DiscreteWrite(&Gpio_0, LED_CHANNEL, LED); latch = 0; } else { Xil_Out32(XPAR_IP_AXI_LEDS_0_S00_AXI_BASEADDR, 0x00000001); - XGpio_DiscreteWrite(&Gpio_0, LED_CHANNEL, LED); + XGpio_DiscreteWrite(&Gpio_0, LED_CHANNEL, ~LED); latch = 1; } - DataBuf = XGpio_DiscreteRead(&Gpio_1, 1); - if (DataBufPrev != DataBuf) { - bild_send_buffer(2, DataBuf); - terminal_uart_send(); - } - DataBufPrev = DataBuf; count = 0; } } diff --git a/XC7Z020.sdk/LEDS_test/src/module_uart.c b/XC7Z020.sdk/LEDS_test/src/module_uart.c index e9248ee..eede118 100644 --- a/XC7Z020.sdk/LEDS_test/src/module_uart.c +++ b/XC7Z020.sdk/LEDS_test/src/module_uart.c @@ -67,11 +67,14 @@ void terminal_uart_send() { SendBuffer[0] = 160; SendBuffer[1] = 160; XUartPs_Send(&UartPs, SendBuffer, TEST_BUFFER_SIZE); +while(UartPs.SendBuffer.RemainingBytes!=0) +{ + XUartPs_Send(&UartPs, UartPs.SendBuffer.NextBytePtr, UartPs.SendBuffer.RemainingBytes); +} } -void terminal_uart_recv() { -XUartPs_Recv(&UartPs, RecvBuffer, TEST_BUFFER_SIZE); -//update_from_terminal(&RecvBuffer); +u32 terminal_uart_recv() { + return XUartPs_Recv(&UartPs, RecvBuffer, TEST_BUFFER_SIZE); } void initialization_of_UART(){ diff --git a/XC7Z020.sdk/LEDS_test/src/module_uart.h b/XC7Z020.sdk/LEDS_test/src/module_uart.h index 6e10fef..8bec02c 100644 --- a/XC7Z020.sdk/LEDS_test/src/module_uart.h +++ b/XC7Z020.sdk/LEDS_test/src/module_uart.h @@ -33,7 +33,7 @@ void inverting_the_signal_count_transmitter(); void bild_send_buffer(u32 address, u32 data); void terminal_uart_send(); -void terminal_uart_recv(); +u32 terminal_uart_recv(); void initialization_of_UART();