Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

...

For NPE X500 the protocol supports reading of digital and analog inputs and status of user button, writing to digital outputs, setting relay outputs, working with user LEDs and a buzzer.

Note: On Raspberry PI, the KOM process must be run under the root user to gain access to the GPIO. It is possible to achieve by setting the setuid bit for the kom binary. Under the user pi, you can do the following:

cd /opt/d2000/bin
sudo chown root kom
sudo chmod 4755 kom


Note: On NPE X500, the KOM process must be run under the root user to gain access to the GPIO (see the previous note for Raspberry PI). An alternative is adding user d2000 to groups and setting appropriate access rights. Under the root user, you can do the following:

sudo usermod -a -G gpio d2000

For access to serial ports also:

sudo usermod -a -G dialout d2000

In order for the d2000 user to access the LEDs and the buzzer, it is necessary to set the rights for the respective files each time the computer starts up. Create a file d2000init in the /etc/init.d directory containing:

#!/bin/bash

### BEGIN INIT INFO
# Provides:          script
# Required-Start:    $all
# Required-Stop: 
# Default-Start:     2 3 4 5
# Default-Stop:     
# Short-Description: D2000Kom
# Description:       Support for D2000 KOM (work with leds/buzzer)
### END INIT INFO

DESC="Set permissions for LED/BUZZER for D2000 KOM"
chmod -R o+w /sys/class/leds/LED1
chmod -R o+w /sys/class/leds/LED2
chmod -R o+w /sys/class/leds/BUZZER


Then run:

chmod 755 /etc/init.d/d2000init
update-rc.d d2000init defaults


Kotva
komunikacna_linka0
komunikacna_linka0
Communication line configuration

...

AddressDescriptionI/O tag typeExamples

DI,id
DI_UP,id
DI_DOWN,id

The GPIO pin will be configured as a digital input. If the voltage of 3.3V is applied to it, the value of input will be 1. If 0V (ground) voltage is applied to it, the value of input will be 0.
Variants DI_UP and DI_DOWN configure the internal pull-up resp. pull-down resistors, so the voltage 3.3V (DI_UP) or ground (DI_DOWN) is connected to the input via the resistor, so even without external voltage applied the input is in a defined state. The DI variant configures the pin so that the pull-up/pull-down resistors are disconnected.
Note: pigpio library supports reading from GPIO pins 0-53.

Di, Ci, AiDI,25
DI_UP,24

DO,id

The GPIO pin will be configured as a digital output. If a value of 1 is written to it, the output will be 3.3V. If 0 is written, output voltage will be 0V (ground).
Note: pigpio library supports writing to GPIO pins 0-53.

Dout, Co, Ao

DO,24

TRIGGER_TOON,id[,filter]
TRIGGER_TOON_UP,id[,filter]
TRIGGER_TOON_TOOFFDOWN,id[,filter]
TRIGGER_UPTOOFF,id[,filter]
TRIGGER_TOOFF_UP_TOON,id[,filter]
TRIGGER_UPTOOFF_TOOFFDOWN,id[,filter]
TRIGGER_DOWN,id[,filter]
TRIGGER_DOWN_TOONUP,id[,filter]
TRIGGER_DOWN_TOOFF,id[,filter]

The GPIO pin will be configured as an counter of input events with an optional filter. The counter can register rising signal edges 0V → 3.3V (TOON), falling edges 3.3V → 0V (TOOFF) and arbitrary any signal changes (without TOON/TOOFF).
Variants with UP/DOWNconfigure the internal pull-up resp. pull-down resistors, the same way as for DI_UP/DI_DOWN addresses.
Parameter filter is used to set a time filter (in microseconds) to filter the noise (if there is shorter time interval between two events than filter, the second event is ignored).  If not specified, all events are considered.
The value of the I/O tag is equal to the number of registered events, the maximum value being 2^31-1 i.e. 2147483647 and then the counter goes again from 0.

Note: The pigpio library uses a standard input sampling with period of 5 microseconds, i.e. with a frequency of 200 kHz.

Ci, Ai

TRIGGER,24
TRIGGER,25,1000
TRIGGER_UP,12
TRIGGER_TOON,12

PWM,id

The GPIO pin will be configured as PWM (pulse width modulation) output. It is then possible to write values 0-255 controlling the width of pulse from fully off to fully on.
Note: pigpio library supports PWM output for GPIO pins 0-31.

Dout, Co, AoPWM,12
REVISON

The revision of the hardware (the number from the "Revision" line from the /proc/cpuinfo file. For example, for RPI 3 this file contains a row
"Revision        : a02082"
and the revision value is 10494082 (after conversion from hexadecimal system).

CiREVISON

...