06-14-2019 06:02 AM
hello, I'm Reiza
I really need a help for my last project. I have to control arm robot Dobot Magician with arduino mega and use labview as the interface. I have to doing a communication serial with labview to sending real time posisition of my arm robot. I do it by using visa read to read serial data from arduino, but the visa read buffer can't always read the data. When I run serial monitor in Arduino, the posisition data is sent normally but when I used the labview, the data won't updated real time, the data changed until I pressed a button in my interface few times. Anyone can tell me how to solved this problem ? I'm very new in labview and I really need some help. I'll attach my program below
thank you
Solved! Go to Solution.
06-14-2019 06:34 AM - edited 06-14-2019 06:35 AM
06-14-2019 06:44 AM
thank you for your response, but I dont really get it what I supposed to do. The event structure that I used is just for sending serial data to controlling the Dobot and nothing wrong with that, the Dobot can controlled. The problem is the labview can read data from arduino
06-14-2019 06:56 AM - edited 06-14-2019 06:57 AM
Hi Reiza,
The event structure that I used is just … and nothing wrong with that
That event structure is actually blocking your loop because there is no timeout set.
That's why you have to " press a button in my interface few times"!
06-14-2019 07:03 AM
so if I set the timeout in the event structure, it will be ok ?
06-14-2019 07:15 AM
06-14-2019 07:45 AM
If I gonna change the VI to send command with serial data via visa write, what method that will you suggest to me for my VI ?
06-14-2019 09:21 AM
@Reiza wrote:
If I gonna change the VI to send command with serial data via visa write, what method that will you suggest to me for my VI ?
I would start by having a good look at the Producer/Consumer and Queued Message Handler. The idea is to break up your code into multiple loops that talk with each other through Queues. This will modularize your code into simple chucks that do 1 specific thing. I would have a GUI loop, Logging loop, Data Processing loop, and an Instrument Communications loop. You can very easily get rid of all of your local variables this way, which will makes things A LOT more efficient and easier to understand.
06-14-2019 10:26 AM
you're right, the problem is in event structure's time out and I find another problem. I assume that visa write and visa read can't work in the same time. In my program, when I set the timeout, visa read looks like waiting for the visa write's timeout and the problem is visa write and visa read have to work in the same time in my program. So what should I do next ?
06-14-2019 10:51 AM
can I use visa duplicate session to make visa read and write work at the same time ?