Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Read real time (pressure) data from CPC6000 and plot on graph using GPIB

Hi, 
I'm trying to read real time pressure data from a Mensor CPC6000 in LabView using GPIB. 

I've tried a basic program using LabView VIs 'GPIB Write' and 'GPIB Read' The CPC has two channels and I would like to plot the pressure readings specifically onto a chart. Manual of CPC shows a range of commands, but as I'm new to this level of labview programming, I'm not sure how they are used.

See preliminary circuit. 

 

0 Kudos
Message 1 of 7
(3,911 Views)

The first thing to know is what interface you will be using to communicate with this instrument.  You will need to enter the proper commands for that interface

  • GPIB (uses the ADDRESS command)
  • TCP (uses the GATEWAY, IP, NETMASK, and PORT commands)
  • Serial (uses the SBAUD, SDATA, SPARITY, and SSTOP commands)

A simple "ID?" at this point should confirm proper communications with the instrument when it responds (See manual for expected response). 

 

The next thing to do would be to configure each channel for how you want to acquire the pressure on that channel. 

 

Now you can begin to acquire pressure by checking that "AS?" responds with "YES" otherwise continue to wait before reading "A?" then continue over and perform the same for the other channel with the "BS?" and "B?" commands before repeating the process and plotting the given results.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 2 of 7
(3,891 Views)

Hi,

Thank you. I've managed to call the pressure values fro both channels using the "A?" and "B?" commands.
To answer your question, Instrument is connected to PC via GPIB (instrument) to USB (PC side).


I've attached block and front panel and block diagram.

 

When reading the values, one of pressure values fluctuates between set value and zero when reading both channels.
When I only read one channel, it seems to be fine. I think it has to do with querying the instrument instantaneously.

 

 

0 Kudos
Message 3 of 7
(3,861 Views)

I'm surprised that you get any values at all trying to read both ports with your code.  The communications need to work as follows:

  1. Establish communications to the device
  2. Set primary channel to read as active
  3. Check that primary channel is ready
  4. Read primary channel when ready
  5. Set other channel to active
  6. Check that other channel is ready
  7. Read other channel when ready
  8. End communications or repeat steps 2-7

You will be unintentionally interleaving the GPIB commands at times when running as both your channel A & B  lines will try run independent of each other; however, there is only a single GPIB bus for communicating with the instrument.  Both lines of your code have no dependencies to each other although each channel has its independent flow control.  This means that it could perform the first GPIB command from channel A then grab the next three from channel B followed with the completion of channel A then complete B and completely confuse the instrument or your expected readings.  It could be a completely different order next iteration.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 4 of 7
(3,856 Views)

I see, I've changed my circuit and used a sequence to avoid the clash.

Ignore the middle 'Chan?' commands, I was using it to investigate which channel was active.

As you can see the 'A?' & 'B?' commands (returns channel pressure readings) seem to be outputting/graphing data simultaneously. I noticed that when I change the while loop intervals, the data outputted by the GPIB blocks also coincides with these intervals. This is important as I would like to read pressure values simultaneously.

 

However 'activating channel A > reading pressure value > activating channel B> reading pressure value' approach showed that data graphed was not simultaneous, i.e. first iteration>channel A pressure reading, second iteration>channel B pressure reading.

 

I'm guessing the need to activate each channel would be mainly for controlling the instrument possibly.

 

Please let me know if my circuit is technically correct, all feedback would be appreciated.

0 Kudos
Message 5 of 7
(3,845 Views)

You do realize that it does not (and cannot) read the A? and B? responses from the instrument simultaneously?  Ignoring the Chan? queries.  It queries the A pressure then the A units followed by the B pressure followed by the B units. 

 

Do the units change during testing?  If not, then perform that read once at the beginning outside of the loop.  It will help to speed up your reading intervals.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 6 of 7
(3,842 Views)

Hello, Mureum can you please send me the last VI if you get it done I need that too please, thank you.

0 Kudos
Message 7 of 7
(2,888 Views)