The World of Mervis - Knowledge Base
The World of Mervis - Knowledge Base

  1. You are here
  2. Home
  3. Welcome to the Mervis Knowledge Base
  4. Mervis IDE/RT
  5. Help
  6. Software
  7. Object Oriented Programming (OOP)
  8. Reference data type

Menu
  • Ancillary services
  • Best Practice
  • Help
  • Licensing & Pricing
  • Mervis DB
  • Mervis IDE/RT
    • Download
    • Communication protocols
    • Help
      • Basic description of the Mervis IDE
      • Start the IDE
      • Process station, or controller (PLC)
      • Communication protocols description
      • Server Communication Protocols
      • New Project
      • HMI Editor
      • Software
        • Common Elements
        • Data Types
        • Object Oriented Programming (OOP)
          • Pointer data type
          • Reference data type
          • Namespace
        • Program Organization Unit (POU)
        • Structured Text
        • FUPLA (Function Block Diagram) Language & Editor
        • Libraries
        • New Solution
        • New Solution in Simple mode
        • Programming Languages
        • Access To Inputs/Outputs Of Inner Blocks
        • Initial Values
        • Dynamic Changes
      • Webpanel
      • Mervis RT
      • Uploading of program to a PLC
      • Mervis IDE/RT to DB Configuration
      • PlcTool
      • Function Block Libraries
      • .Net Server for Mervis RT
    • Mervis RT
    • Webpanel
    • PlcTool
    • Mervis IDE/RT to DB Configuration
  • Proxy & CloudAccess
  • Mervis SCADA
  • RcWare
  • Research

Reference data type

A reference is a variable which only contains a link to a variable or to a function block instance. The used variable may be of elementary or derived data type.

  • A reference is declared using the keyword REFERENCE TO. Then, the name of the referrede data type follows.
  • The pointer is initialised using the REF= operator.

Example

VAR
    MyRef : REF_TO INT;
    MyVar : INT;
END_VAR
 
MyVar := 100;
MyRef := REF(MyVar); //setting of a reference to a variable
MyRef := 200;        //there is a new value of 200 in the variable now
    Log In