10-15-2024 11:33 PM
I'm have connected string control to visa write inside the while loop, and I'm trying to write data to STM32 via UART so an orange led can blink , so i want to understand in which format does visa write function send string data???
I tried but its not working.
can someone help?
10-15-2024 11:35 PM
Please watch this before you proceed - https://labviewwiki.org/wiki/VIWeek_2020/Proper_way_to_communicate_over_serial
10-16-2024 01:19 AM
Hi Anup,
@Anup13 wrote:
i want to understand in which format does visa write function send string data???
A string is basically a byte array in LabVIEW, and VISAWrite will transfer that string/bytearray as is.
@Anup13 wrote:
I tried but its not working.
What did you try?
What is "not working"?
Do you get any errors?
10-16-2024 01:22 AM
I'm not getting any error in labview block diagram and front panel.
i used string indicator also to indicate that data is being sent but its not showing in stm32.
now im trying to debug in cube ide that if data is recieving in stm32 buffer or not?
10-16-2024 01:30 AM - edited 10-16-2024 01:30 AM
Hi Anup,
@Anup13 wrote:
now im trying to debug in cube ide that if data is recieving in stm32 buffer or not?
Yes.
Does the STM32 code expect/require any TerminationChars in your string message?
(As has been said before: watch the video linked in the previous message!)
10-17-2024 04:10 AM - edited 10-17-2024 04:20 AM
I'm using VISA write function to write data to STM32 via UART, the data is showing in debug of stmcubeide, but its not processing further like blink an led or giving back response to labVIEW like " data received" or like printing in lcd display which is connected to stm32 via I2C.
help!
10-17-2024 05:03 AM
if i send data from visa write , it goes in ASCII format, then the stm32 will convert automatically the ASCII data into string and work further. do i have to do anything in labview setup or i have to check stm32 code because the data is showing in debug of STMcube IDE which means STM32 is recieving data. so what are the issues im getting?
10-17-2024 05:08 AM - edited 10-17-2024 05:12 AM
We have no idea! Obviously as you say the data arrives at your micro, since you see it in your debug console there. So as far as LabVIEW and VISA is concerned all seems well. There is usually no conversion between ASCII and string in any way, they are the same unless your target supports Unicode. But that seems a bit unlikely for an STM32 microprocessor board (possible yes but not so likely).
You will have to understand what your code on the STM32 tries to do with that data. It might be expecting a specific format, or binary data instead of string data. We do not know, only you know what code is executed on the STM32.
10-17-2024 05:43 AM
this is the code I'm using
int main()
{
SystemInit();
UartInit(BAUD_115200);
LedInit(LED_ORANGE);
char pqr[BUFFER_SIZE]; // Declare buffer using the defined size
UartGets(pqr);
UartPuts("Received data: "); // Debug statement
UartPuts(pqr); // Print received data
UartPuts("\r\n");
// Check if a string has been received and stored in the buffer
if (pqr[0] != '\0' && pqr[0] != '\r' && pqr[0] != '\n') // Check if the buffer is not empty
{
LedBlink(LED_ORANGE, 1000); // Blink the LED
UartPuts("Data received: ");
UartPuts(pqr); // Send the string back
UartPuts("\r\n");
// Convert ASCII values in the buffer to letters
ConvertAsciiToLetters(pqr);
}
else
{
// Buffer is empty, no string received
UartPuts("No data received.\r\n");
}
return 0;
}
10-17-2024 05:51 AM