Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems reading from Hameg 4040 via VISA RS232

Solved!
Go to solution

Hello Guys!

 

I'm trying to control my Hameg 4040 Power Supply via SCPI over VISA (RS232).

 

Writing works fine, but Reading back values won't work.

 

Tried to do a simple Test.vi which should just set voltage and current.

after this i want to read back my actual voltage.

 

I took the example SCPI codes from the manual, so should work (i think...)

 

Here is my VI and FGV

 

test_vi.png

FGV

 

 

Maybe someone could figure out my problem?!

 

 

br

Sagi

0 Kudos
Message 1 of 15
(6,182 Views)

Found the Problem, but cant really understand why it behaves like that...

 

The while loop runs always three times... with two iterations no value have been read by then...

FGV_Neu.png

0 Kudos
Message 2 of 15
(6,172 Views)

Next "funny" thing is that if I use the provided Express VIs reading is quiet fast, but for now i can't see dthe difference to my code...

 

test_vi_express.png

 

0 Kudos
Message 3 of 15
(6,163 Views)

Hello Sagme_Mi,

 

I assume you are reading too fast, after sending the command. I attached a VI, which shows how I approach an Write-Read Operation. I also attached a snapshot of the block diagram for the case you're using an older version of LabVIEW.

 

If the builder of the express VI hasn't this option, here is how you can see the code inside an express VI.

 

Right click on the express VI>>open front panel>>click "Yes" on the dialog

 

kind regards 

 

Download All
0 Kudos
Message 4 of 15
(6,132 Views)

sorry,

 

If the builder of the express VI hasn't blocked this option...

0 Kudos
Message 5 of 15
(6,116 Views)

@HeinzGebel wrote:

Hello Sagme_Mi,

 

I assume you are reading too fast, after sending the command. with this encluded1!.PNG

 


Heinz, You can safely execute the loop 0 times if you put the VISA Resource on a shift register

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 15
(6,108 Views)

Hi Jeff,

 

I tried and it works. Thanks a lot for your advice.

 

Kind regards

Heinz 

0 Kudos
Message 7 of 15
(6,090 Views)

Hi!

 

I tried to open the Front Panel of the Express VIs, it's blocked 😕

So it is not possible to have a look behind the scenes...

 

I also tried your solution(s) I have the same problems as before.

 

Do I miss an important VISA setting, which the express VIs might set?

 

For now I use only:

-BaudRate(9600), I also tried faster rates but everything above 19200 doesnt work for writing either

-Timeout (2000)

-Parity None (as selected on the PS)

-Stop Bits 1 (also, as selected on the PS)

 

 

I also have found a problem in writing mode...

I cant set all four channels to a specified value:

test.png

 

What i dont understand is, after running trough this section, the PS have selected OUT1 with the right value but not one of the other channels.

!!!Also if i change the order of my string array...!!!

 

br

Sagme_Mi

0 Kudos
Message 8 of 15
(6,085 Views)
Solution
Accepted by topic author Sagme_Mi

Hi Sagme_Mi,

 

I have some more questions for you:

 

1. What "timeout in ms" did you set in my vi?

2. How many bytes are you expecting and how many do you get? Do you get any at all? 

3. Maybe the hameg is waiting fo an termination character like 0x0A. Do you send one?

 

First of all I would try to establish the communication with an Hyperterminal like HTerm.

There are also several free tools to monitor the communication over your COM-Port. With such a tool you could observe what the expressVI is doing differently than your VI.

 

Kind regards

heinz

Message 9 of 15
(6,075 Views)

If you want to see what the Express vi's are doing Hyperterminal won't help.  Unless you have two spare com ports and a "Sniffer" program VISA should lock access to the port and prevent hyperterminal from accessing the stream.  NI SPY will help here  (Heinz, are you  NI employee or are you just "accidentally blue"?)

 

Sagme, Can you link to the users manual for the device?  It is likely that the express vi drivers did not account for some features of the device.


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 15
(6,068 Views)