DDE Read Example

<< Click to Display Table of Contents >>

Navigation:  Instrument Connectivity > DDE (Dynamic Data Exchange) - Overview >

DDE Read Example

Previous pageReturn to chapter overviewNext page

 

An example of Excel reading some items from an Instrument called 'Zone1' follow.

See the important note at the bottom of this section.

Type these formulas into cells on the Spreadsheet:

=SpecView|Status!LastError                To get the Error Reason in case of an error.

=SpecView|Status!ErrorItem                To get the Item for which the last error ocurred.

=SpecView|var!Zone1.pv                Get the Process Val at medium rate

=SpecView|var!Zone1.OP                Get the Output Power at medium rate

=SpecView|var!'Zone1.pv,h'                Get the PV at the high rate. The quotes allow Excel to not treat the comma as part of some strange formula.

=SpecView|var!'Zone1.Output Power'        Get the OP, using its full name.

=SpecView|var!SpecView.Number1        To get the SpecView User Variable called Number1

 

Since you are typing this into Excel as a formula, there are certain restrictions you must observe.  In particular, where the name of an Instrument or variable contains any character likely to affect Excel's formula engine, then the item must be enclosed in quotes so that Excel does not see it.  For example, suppose (hypothetically) you had named an instrument  'Zone + 2'.  If you just type in:

=SpecView|var!Zone + 2.pv

Then this is a formula that takes 'SpecView|var!Zone' and adds two to it.

To get Excel to correctly read the formula, you need to put quotes in:

=SpecView|var!'Zone + 2.pv'

This applies particularly to the following cases:

'Output Power' - has a space.

'Auto/Manual' - has a slash - could be seen as a divide.

'inst.param,RATE' - the comma will confuse - so if a rate is specified, use the quotes.

Return to DDE help topics