LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial communication

Hello all,

 

I'm using Labview to communicate with the stm32 microcontroller through RS232 using UART communication

 - the stm32 part: i'm using a code that displays a string example: "hello" , i'm using IAR that loads the code into stm's memory to execute it(i used hyperterminal and it worked)

 - the labview part: i'm using the basic serial write and read VI

 

When i run the vi (i've added a while loop to make this vi running while i'm running the code on IAR )  errors show up.

1-what causes these errors and how to eliminate them?

2-please correct me if i'm wrong: when STM32 executes my code the data(hello for exmaple) is put into a buffer then when i run labview ,the vi reads the information from that buffer and displays it. so there is no need to run labview and keep it working while i run the stm32 code??? i mean i can run  stm code then i run the vi to get the data.(i need the right sequence to do that what must be run first and if there is any synchronisation between stm32 and labview for example adding delays or others?????)

 

 

Thank you for helping me,, i'm really confused  i've done so many researches but in vain 😞 

 

NB: below attached:

- A print screen of the vi (basic serial)

- The configuration :baud rate...(the same config on both IAR code and labview one)

- Error and explanation

 

0 Kudos
Message 1 of 5
(2,603 Views)

Hello,

            Why you are initializing and closing port for every iteration. Try to put those two VI out of the loop and run again. Drag the VISA initialization VI and close VI out of the loop.

0 Kudos
Message 2 of 5
(2,591 Views)

Hi shjukheter,

 

Thank you for your quick responce , with excluding initializing and closing port it works!! but labview displays the data for a short moment (less then 1 second then it disapears!)  what i want is to keep the information displayed in  the read string area. Can you please explain how it works ? i mean data shouldn't disapear because it is stored in the buffer and labview keep reading this same buffer, rationally talking labview would display the data as long as we want !!!

 

thanks 🙂

 

NB: Below attached the vi after excluding the mentionned VIs.

0 Kudos
Message 3 of 5
(2,571 Views)

Yes,

 

             Your reading and writing the data continously until you have the code inside while lopp. Anyway, If you want store the data in arrays or display in textboxes, please search on forum, you will find lot of threads on this forum. Just make a search on "serial".

 

Suggestions,

              Still you don't have much grip on your program to handles errors. If you unplug the serial device when the program running. It may lead to errors. To overcome this use the error wire to handle this exception.

Message 4 of 5
(2,565 Views)

thank you  for your help i'll try to find it out by searching on forums as you adviced me to!

0 Kudos
Message 5 of 5
(2,561 Views)