Analog inputs/outputs

RB300 and RB350 have four analog inputs 0-10V and two analog outputs 0-10V. Analog inputs and outputs are controlled by the SPI interface (/dev/spidev0.1). SPI settings:

  • mode bits: CPHA = 1, CPOL = 0,
  • bits per word: 8,
  • max. speed 2 MHz.

Analog outputs

The following figure shows the write analog outputs frame. Each rectangle represents one byte.

0X4F AO1[7:0] AO1[15:8] AO2[7:0] AO2[15:8]

Fig. 1. Write analog outputs frame

The value 1000 corresponds to the output voltage 10V. If the fifteenth bit of the output value is 1 then the output is ignored. Frame timeout is 100ms.

Example 1

Set both analog outputs: AO1 = 10.0V ⇒ 1000 ⇒ 0x03E8 AO2 = 5.0V ⇒ 500 ⇒ 0x01F4

0X4F 0XE8 0X03 0XF4 0X01

Fig. 2. Write analog outputs frame - example 1

Example 2

Set only A01: AO1 = 10.0V ⇒ 1000 ⇒ 0x03E8

0X4F 0XE8 0X03 0X00 0X80

Fig. 3. Write analog outputs frame - example 2

Example 3

Set only A02: AO2 = 5.0V ⇒ 500 ⇒ 0x01F4

0X4F 0X00 0X80 0XF4 0X01

Fig. 4. Write analog outputs frame - example 3

Analog inputs

The following figure shows the read analog inputs frame. Each rectangle represents one byte.

0X41 AI1[7:0] AI1[15:8] AI2[7:0] AI2[15:8] AI3[7:0] AI3[15:8] AI4[7:0] AI4[15:8]

Fig. 5. Read analog inputs frame

Between the first two bytes (0x41 and AI1[7:0]) there should be a delay of at least 100 µs.

The voltage at the analog input can be calculated using the formula:

Vin = ((AI[15:8] ← 8) OR AI[7:0]) · 10.065 / 1023.0

where:

- "<<" denotes a left shift by 8 bits,

- "|" denotes a bitwise OR operation.