From OpenSCADAWiki
Jump to: navigation, search
Other languages:
Constr.png The translation checking and actualizing
Module Name Version License Source Languages Platforms Type Author Description
BCM2835 BCM 2835 1.2 GPL2 daq_BCM2835.so en,uk,ru,de x86,x86_64,ARM DAQ Roman Savochenko Broadcom BCM 2835 GPIO. Mostly for and used in Raspberry Pi.

The module provides OpenSCADA system with the support data sources of realtime, which based on Raspberry PI board's General Purpose Input/Output (GPIO) grounded on BCM2835 chip. The BCM2835 GPIO of Raspberry Pi counts 32 pins in maximum some from its can also performs alternative functions like: I2C, UART, SPIO. For access to the GPIO in general functions there is used a library libBCM2835, which included and builds together with the module.

1 Controller object

GPIO into OpenSCADA configured with new controller object creation (Fig.1) and the container parameters' objects — a single parameter of the board's GPIO.

Fig.1. Configuration tab of a controller object.

From this tab you can set:

  • The state of the controller, as follows: Status "Enable", "Run" and the name of the database containing the configuration.
  • Id, name and description of the controller.
  • The state, in which the controller must be switched at boot: "To enable" and "To start".
  • Name of table to store the configuration of the parameters of the controller.

2 The controller's parameter object

The parameter object is a direct representative-reflection for the GPIO, which contains attributes set with Boolean types and it whole quantity 32. Parameter's object configuration tab is shown in Figure 2. The acquisition data is done only in synchronous mode but GPIO must be fast.

Fig.2. Configuration tab of a parameter.

With the parameter's object configuration tab you can set:

  • The state of the parameter: type, "Enable" and static functions list.
  • Id, name and description of the parameter.
  • The state, in which the parameter must be translated at boot: "To enable".

Tab "Attributes" for the GPIO is shown in Figure 3. For the GPIO there is accessed also "Configuration" tab (Fig.4) with IO mode and reverse state.

Fig.3. Tab "Attributes" of a parameter.
Fig.4. Tab "Configuration" of a parameter.

For maximum fast access to the GPIO the parameter object provides three static functions: "mode", "get" and "put". These functions can be used in an user programming area of OpenSCADA system for the organization of not ordinary interaction algorithms. To address the functions you can use static call address BCM2835.{cntr}.{prm}.{Func}() or dynamic SYS.DAQ.BCM2835.{cntr}.{prm}["{Func}"].call(). Where:

  • {cntr} — identifier of the controller's object;
  • {prm} — identifier of the parameter's object;
  • {Func} — identifier of the function.

3 Function GPIO: Mode (mode)

Description: GPIO mode, input or output.
Parameters:

ID Parameter Type Mode By defaults
rez Result Integer Return
pin Pin Integer Input
set Force the input mode: 1-Input, 2-Input (pull up), 3-Input (pull down), 4-Output Integer Input 0

4 Function GPIO: Get (get)

Description: GPIO get pin level.
Parameters:

ID Parameter Type Mode By defaults
rez Result Bool Return
pin Pin Integer Input

5 Function GPIO: Put (put)

Description: GPIO put pin level.
Parameters:

ID Parameter Type Mode By defaults
pin Pin Integer Input
val Value Bool Input

6 Notes

The module has been tested on boards Raspberry Pi 2, 3 model B. For details you can see to the page and the task.

Access time to the static functions was measured comparing to the different methods which you can see here.

For derivative DAQ templates creation using the static functions you can use also dynamic linking to its, like this:

function put = addr+".fnc_put";
if(put) {
  put(D4, vl&0x10);
  put(D5, vl&0x20);
  put(D6, vl&0x40);
  put(D7, vl&0x80);
}

In this configurable way there for now have implemented next templates of the low-level devices: