User's Guide

7
Arad Technologies Ltd. | st. HaMada, Yokneam Elite , 2069206, Israel | www.arad.co.il
3 Encoder SW architecture
3.1 Encoder module is very simple configurable system that:
3.1.1 Provides a high-resolution pulse output signal.
3.1.2 Can translate received data from Sonata to electrical pulse for each unit of
measurement according to Encoder module configuration. The electrical pulse is
transmitted over a two-conductor or three-conductor cable to the remote readout
systems.
3.1.3 Supports communication interface with different pulse Readers.
3.1.4 The Encoder model is built from a module that only transmits the last string it received
from the Sonata meter without any post processing.
3.2 Encoder module SW architecture is an interrupt-driven SW architecture:
SPI RX interrupt
Reader clock interrupts
Timeouts
3.3 The main program consists of system initialization and a main loop.
3.3.1 During the main loop the system waits for SPI RX interrupt or reader interrupt to
occur.
3.3.2 If no interrupt occurred and no pulse out command was received the system enters
“Power down mode.
3.3.3 The system wakes from “Power down mode by SPI’s interrupt or reader’s clock
interrupt.
3.3.4 SPI and reader events are processed in ISRs.
3.4 The following figure shows the Encoder module SPI event handle block.
Open fault SPI Rx
message detection timer
Last byte received?
Check Sum correct?
Yes
03/12/2017
Ver. 1.00 Evgeni K.
SPI ISR handle block
Save received SPI Rx
byte
Update SPI error byte
No
No
Parse received SPI
message
Yes
Exit