LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication with LabVIEW

Solved!
Go to solution

Hi Community,

I Have a problem when i try communicating between Labview & Rigol power supply.

 

Find the attached code. The command for applying voltage is :APPL X, where X is voltage to be applied. when i give this command directly the supply will respond.

Since i need to vary this voltage, hence i am using concatenating operation so that i can vary the 3rd element in concatenate block.

 

But the code with concatenate is neither giving any error nor output is reflecting on the power supply.

 

Open stage wise input program. Help me out.

Download All
0 Kudos
Message 1 of 8
(3,234 Views)

Hi suma,

 

what about appending a LF char as is done in your "Command" control?

(Enable the display style indicator for that string control and switch it to "\-Codes"-displaymode!)

 

I guess this comment is also given in the (programming) manual of your device…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,206 Views)

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours 
LabVIEW Introduction Course - Six Hours 

 

Your code is inside out.  You shouldn't have a while loop in the subVI, because you can't stop if from the main VI if it starts running and you have a False wired into that close input.

 

You should initialize your serial port before your Main VI's while loop, communicate inside, and close it after the while loop.

Note that using bytes at port is the wrong thing to use 99% of the time.  If your device sends a termination character, then rely on that to stop the VISA read when you read a large number of bytes.

 

Your subVI's connector panel is mixed up.  You should have inputs (controls) to the left terminals, and outputs (indicators) connected to the right side terminals.  A universally accept LabVIEW style has Error In terminal to the lower left and Error Out to the lower right.

0 Kudos
Message 3 of 8
(3,188 Views)

Now I enabled the \code display. Now my command is looking like :APPL\s3 instead of :APPL 3.

What should i do to get :APPL 3 command.

0 Kudos
Message 4 of 8
(3,171 Views)
Solution
Accepted by topic author suma_n

Hi suma,

 

Now my command is looking like :APPL\s3 instead of :APPL 3.

Your command should look like ":APPL\s3\n"!

Did you read the manual of your device?

Did you read the paragraph which explain the proper TermChar usage to initiate commands?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 8
(3,166 Views)

Attached is the manual of my device.

They have not mentioned all these.

 

But now its working with this ":APPL\s3\n"!

Thank you.

0 Kudos
Message 6 of 8
(3,162 Views)

Hi suma,

 

They have not mentioned all these.

Please read page 1-2!

(There's a "Note:" right at the top!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 8
(3,158 Views)

@suma_n wrote:

Attached is the manual of my device.

They have not mentioned all these.

 

But now its working with this ":APPL\s3\n"!

Thank you.


I believe you do not understand what the Backslash ('\') Codes Display actually is.  Here is a link to the online help for this feature:

Backslash ('\') Codes Display.

 

Upon reading this, you should be able to understand that the manual was mentioning it all along.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 8
(3,139 Views)