Showing results for 
Search instead for 
Did you mean: 

Serial communication with visa, need help

Go to solution

Im sending G-codes(which is a string in this case) to my board, Im using event structure to choose to sent which code, while sending as string constants program runs without problem, but when Im obtaining the string with format into string program dosnt sent the code in that event but its sents when the events changes( so in other event it runs previous one too)

problem can't be seen in highlight execution too

0 Kudos
Message 1 of 12

Hi 6a,


whenever you have a problem with a specific VI you should attach that VI here!


Generic answer an your question: When you have problems in using FormatIntoString you should read it's help page and use proper format strings…

Best regards,

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 2 of 12

I have no problem with formatintostring I can obtain what I want, my inside of events work perfectly the problem is event6 doesnt work until another event kicks in like when its 6 it doesnt work but when I change to 5 it runs 6 first after that it runs5

Download All
0 Kudos
Message 3 of 12

You didn't send a VI like Gerd asked, just a couple screenshots.


Those show two events, each one sends a string when a particular button is pressed.


The problem you are describing doesn't make any sense.  But if you attached a VI, we could see everything that is going on, play with it, and see if it is acting the same way for us.


Do you need to send a termination character with your command?

0 Kudos
Message 4 of 12

Yeah it doesnt make any sense I know, here is the vi

0 Kudos
Message 5 of 12

Im sending directly the gcodes to the board all the event except 6 runs perfectly but 6 doesnt waits to run after the event changes it runs which makes no sense 

0 Kudos
Message 6 of 12
Accepted by aaa_aaa

I'll ask again:   Do you need to send a termination character with your command?


Your 4 home button events all have commands that end in the line feed character.  Your other events do not.  My guess is that the device does not recoginize it has received a full valid command until it gets the line feed character.


PS:  Those button terminals all belong in their respective event cases.

Message 7 of 12

 Thank you that solved my problem , I can't believe I forgot to add one line below, I deliberately did that in home cases yet I didn't add on last event or even saw it's missing. Anyway thanks again


Even though I limited the instance to 1 even cases runs twice most of the time, How can I solve this?

0 Kudos
Message 8 of 12

Change the mechanical action on your buttons to Latch When Released (and move the buttons in the event case.)  Right now you are Switch Until Released which generates a value change event when you press it down and when you release it.


(PS:  This is why many of us insist that people post real VI's when asking for help.  We can't see other event cases from a screen shot to clue us in to what is going wrong.  And we certainly can't tell from an image what is the mechanical action of a button.)

Message 9 of 12

Thank you again, I understand where the problem is, Is there an another solution i want to keep them as buttons not switches.( I dont want to see them as pressed all the time)


And I know I ask a lot ( Im quiet new to Labview)at event's outputs I use default if unwired, which makes them 0. Is there a way to not change them when unwired?  

0 Kudos
Message 10 of 12