LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA WRITE FUNCTION

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?

0 Kudos
Message 1 of 18
(558 Views)

Please watch this before you proceed - https://labviewwiki.org/wiki/VIWeek_2020/Proper_way_to_communicate_over_serial

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 18
(556 Views)

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 18
(522 Views)

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?

0 Kudos
Message 4 of 18
(518 Views)

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!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 18
(509 Views)

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!

0 Kudos
Message 6 of 18
(486 Views)

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?

0 Kudos
Message 7 of 18
(464 Views)

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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 18
(456 Views)

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;
}

0 Kudos
Message 9 of 18
(433 Views)

Hi anup,

 

How long/often is the STM code executed?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 18
(429 Views)