ADbasic

from Wikipedia, the free encyclopedia

ADbasic is a commercial programming language from Jäger Computergesteuerte Messtechnik GmbH. The language is based on BASIC and is used for programming the ADwin devices from the same company.

The first version of the development environment appeared in 1994 for Microsoft Windows . Today there is also a compiler for Linux .

The areas of application of ADbasic are control , measurement and automation technology . The programming follows the process model of the general control loop , making the language suitable for simple programming of controls. An ADbasic program is executed cyclically at fixed time intervals; In addition, the initialization and final processing of data can be programmed.

ADbasic is a text-oriented language. The basic commands are based on BASIC and also enable structured programming. ADbasic contains a large number of specific commands that access the hardware of the ADwin devices and process analog and digital signals of various kinds there.

The ADbasic compiler is a cross compiler that generates directly executable binary code for ADwin devices. The performance of the executed processes depends on the performance of the ADwin device used; control frequencies in the range of up to a few megahertz can be achieved while maintaining hard real time .

Processes written in ADbasic can exchange data with the PC. There are interfaces available for many programming languages ​​(e.g. C ++ , Visual Basic , C # , Object Pascal , Java ) and program packages (e.g. Matlab , LabVIEW , Diadem). This allows the user to use the data on the PC, e.g. B. in user interfaces you have created yourself.

Additional packages contained in ADbasic

Additional tools are available in the scope of delivery of ADbasic, including:

  • Text editor and development environment. A text editor specially developed for ADbasic, which simplifies the development of ADbasic processes. Among other things, he supports:
    • Highlighting the ADbasic syntax
    • Automatic identification of functions
    • Line numbering
    • Help function
    • Compile the source code and start it on the hardware
    • Read and display data from the hardware
    • Optimization of processes
  • ADtools. A package of auxiliary programs with which variable values ​​and system properties of running processes can be displayed graphically. Processes can also be started and stopped. ADtools make it possible to put together a simple user interface for ADbasic processes.

Examples

Signal generator

The following source code is the ADbasic program of a signal generator that outputs a sawtooth voltage at an analog output:

EVENT:
  DAC(1, PAR_2)
  PAR_2 = PAR_2 + 1
  IF (PAR_2 > 65535) THEN
    PAR_2 = 0
  ENDIF

The EVENT program section : defines the process that is run through regularly at short intervals until the process stops:

  • Output of PAR_2 to analog output 1.
The DAC ( digital-analog converter ) command generates the voltage associated with digital value PAR_2 at analog output 1 .
  • Increase the variable value by 1.
  • As soon as PAR_2 becomes greater than 65,535, the variable value is set to 0 again.

P controller

The following source code is the ADbasic program for a proportional controller :

#DEFINE offset 32768
DIM cd, av AS LONG 

INIT:
  PAR_1 = offset
  PAR_2 = 10

EVENT:
  cd = PAR_1 - ADC(1)
  av = cd * PAR_2 + offset
  DAC(1,av)

First the program defines the constants and variables:

  • Constant offset : digital value that corresponds to the voltage 0 volts at the analog output.
  • Variable cd : system deviation .
  • Variable av : manipulated variable.
  • Variable PAR_1 : setpoint of the controlled variable.
  • Variable PAR_2 : Gain = characteristic value P of the controller.

The INIT: program section assigns the start values ​​of the P controller to the variables.

The EVENT program section : defines the control process, which is run through regularly at defined time intervals until the process is stopped:

  • Calculation of the control difference cd ; it is ADC (1) , the controlled variable.
The ADC ( analog-digital converter ) command converts the analog signal on input channel 1 and returns the corresponding digital value.
  • Calculation of the manipulated variable av from the system deviation and gain PAR_2 .
  • Output of the manipulated variable av on analog output 1.
The DAC ( digital-analog converter ) command generates the voltage associated with the digital value av at analog output 1 .

See also

Web links