CANNY 7 is a miniature programmable logic controller designed for automotive, domestic and industrial use.

General Information

CANNY 7 has a limited number of external channels and can therefore be classified as a smart relay or a Nano PLC. Nevertheless, CANNY 7 has enough channels and driver features to serve as a solution for many different control, automated and monitoral tasks.

CANNY 7 is the first programmable logic controller specifically designed for automotive applications, with the following unique combination of features:

  • rated power supply and IO channel voltage 0…12V (18V max);
  • the maximum output current of each of the 11 IO channels: +/- 120mA, sufficient to control a standard automotive relay;
  • CAN 2.0B interface, compliant with ISO-11898, SAE J2411 standards, which are widely used in modern cars;
  • built-in energy consumption management in the range of 5 to 60 mA, helps conserve battery power during a period of inactivity in a car;
  • EEPROM for applications and sixty-four 16-bit non-volatile memory data cells, available to user application for preserving critical data during a power failure;
  • wide operating temperature range from -40 to + 85 ° C;
  • integrated surge protection and short circuit protection;
  • compact IP50 compliant housing, suitable for installation and operation as part of a car’s cabin equipment;
  • specialised packages of system and application software for use with automotive CAN and LIN networks.

The CFD (Canny Function Diagram) visual programming language was created specifically for the purpose of creating applications in a fast, intuitive fashion. These programs are called function diagrams. The free CannyLab IDE is used to create, edit, debug and deploy these programs.

Requirements for writing software to the controller:

  • PC with a USB port version 1.1 or higher;
  • installed CannyLab IDE;
  • ordinary miniUSB cable.

The amount of controller memory accessible to you is enough to accommodate a function diagram consisting of several hundred function blocks. This allows you to implement fairly sophisticated algorithmms.

Each of the 11 IO channels is able to operate in any of the 98 modes that define voltage, current, and temporal parameters of input and output signals. In addition, some of these channels can be configured to operate in digital mode, to transmit / receive data via such protocols as 1-Wire, I2C, RS-232, LIN, CAN. The configuration of each channel can be set and adjusted from the user application.

The controller has a two-coloured LED controlled from the user application, useful for indicating controller operation mode and debugging.

Design and functional operation

The appearance and layout

The main components of CANNY 7 are:

  • a micro controller (MCU) with the auxiliary circuits;
  • a power supply system for all controller elements;
  • IO channels level matching circuit;
  • electric protection system;
  • connectors and LED.

All of these components are based on a single 65 x 23 mm printed circuit board, mounted inside a quick-to-open plastic housing.

The controller has three external connectors and one internal. To connect the controller to the power supply and external devices, the development kit includes a set of cable harnesses:

  • external connector X1. Contains four pins: + 12V input, power input GND, CAN-H and CAN-L.
  • external connector X2. Contains eight pins, corresponding to the first eight channels of the controller, from №0 to №7.
  • external connector X3. Contains three pins, channels, corresponding accordingly to channels №8, №9 and №10;
  • internal connector USB1. Used to connect controller to the PC via a miniUSB cable.
Appearance and arrangement of CANNY 7 elements

Software Architecture

CANNY 7 is a digital programmable computing controller. Its main structural elements are: - arithmetic logic unit (ALU); - internal memory; - command execution management subsystem; - input-output system.

CANNY 7 controller software architecture

Arithmetic Logic Unit is the processing core of CANNY 7. ALU is used to execute both system software and function diagrams that were uploaded into the controller’s internal memory. The controller’s internal memory is divided into the EEP program memory, EEP data memory, and ROM. The command management subsystem is responsible for switching and setting up the operation mode of the controller. The IO system is used to communicate with the outside world, using both discrete IO channels and standard digital interfaces CAN / LIN / RS232 / USB.

Software Structure

CANNY 7 software structure

CANNY 7 software structure consists of:

  • a bootloader;
  • system software (operating system and drivers);
  • function diagram.

The bootloader enables the operation of the controller in the software download mod by organizing data transmission between CANNY 7 and the PC using the USB protocol. It is responsible for checking the integrity of data transmitted for PC and subsequently writing it to the controller’s internal memory. The bootloader is placed into the internal memory of the controller during production and can not be deleted or modified by you.

The manufacturer distributes CANNY 7 firmware in the CCX file format. Firmware includes an operating system and a set of drivers providing function diagram execution and its interaction with controller resources. You can write/erase firmware to/from the controller, but you cannot modify CCX file content.

The function diagram is created and modified in CannyLab IDE. You can then save it to a CFD file or load it into the controller where it specifies the controller’s algorithm in Run mode.

Operation modes

There are three operation modes, each of them used for specific functionality.

Software download mode

In software download mode, the controller is ran by bootloader. The bootloader writes firmware and function diagrams according to commands received from the CannyLab IDE. Transition to this mode happens automatically when the controller is connected to a PC via a USB cable. During the transition to software upload mode the controller performs a master reset: the function diagram execution stops, IO channels are switched to the neutral state, built-in green LED turns on. When the controller establishes communication with CannyLab, the green LED starts blinking.

This mode is exited automatically when the controller is disconnected from the PC. When exiting the mode if system software is loaded into the EEPROM correctly, the controller will switch to running mode, otherwise it returns to software download mode.

Run mode

Run mode is the controller’s main operation mode. In this mode, the controller is operated by the system software continuously, executing the function diagram in a never-ending loop. Transition to this mode happens automatically when the controller is connected to an external 12V power supply and not connected via USB. In this mode the function diagram has access to all controller resources that are supported by the drivers currently uploaded to the controller.

Sleep mode

This mode is a variant of run mode in which the controller pauses to reduce its power consumption to a minimum after each loop of the function diagram. Thus, the controller operates in a “pulsed” mode, periodically “falling asleep” and “waking up”. Enable, disable, and configure the parameters of this mode via the function diagram. This mode is useful when developing systems where power consumption matters, such as on-board car equipment.

Runtime Environment

Function diagram presentation

Programs for CANNY 7 controller, function diagrams are developed within the CannyLab IDE. Upon uploading the diagram to the controller, it is automatically processed by the translator. The translator checks the consistency of the diagram, determines function block execution order and converts the diagram into the executable code - a sequence of machine instructions for CANNY 7 controller’s ALU.

The execution order

When written to the controller the executable program code is included in the sequence of system software machine instructions. Thus, the entire command sequence for a controller that contains both system software and a function diagram will be:

  • initialisation routine executed once after each reset of the controller;
  • infinite loop, called the diagram execution loop. It consists of:
  • procedures for reading the status of hardware resources;
  • executable function diagram code;
  • procedures for changing the status of hardware resources.

Some of the drivers included in the controller system software, such as the CAN driver, need the controller to react immediately to program events and received data. Program code of these drivers is asynchronously processed by the controller in parallel with the main execution flow. When processing asynchronous drivers calls, the execution of the diagram’s main loop is briefly suspended.

CANNY 7 diagram execution algorithm.

Access to hardware resources

The following resources are available from the function diagram :

  • controller system resources;
  • IO subsystem;
  • additional drivers included in the system software.

All of these resources appear within the controller’s internal memory protected address space. This address space is divided into input and output registers.

You can use input registers as a source of input data for virtually any function block of the diagram. This allows you to access and use the data received by the controller from the outside world for your algorithms. For example, you can access information about the electric potential on any of the controller’s connector pins, or data packet contents received via the CAN bus.

You can use output registers as the output target for any function block on the diagram. This lets you control controller resources from the function diagram, which lets you influence objects in the outside world. For example, you can switch an external relay by changing the electrical potential on one of the pins of the controller, turn the controller LED on, set CAN operation mode, send a data packet via the CAN bus.

To use most controller resources you will first need to assign the necessary operating parameters, such as the polarity of output channels, the polarity and the sensitivity of input channels, CAN communication speed and so on.

Assigning these parameters is done by recording special constants into one or several specific output registers, depending on the resource that needs to be accessed. For example, writing a constant with a value of 121 into the register located at 2432 address sets channel №0 to an output positive polarity mode.

Writing a constant to a controller register

For user convenience all the of the controller’s available registers, as well as all special constants used for interacting with these resources, are named. As demonstrated above, instead of writing 121 into the register 2432, you instead write a named “Default Positive Output” constant to “Discrete Input/Output Mode Setup Register, IO Channel №0”.

Receiving a signal from an input register

After setting up the channel №0 mode, we can read the value from the register located at 2465 address (“Discrete Input Value Register, IO Channel №0”). If we receive the value 1, for example, we can learn that positive electric potential was applied to to №1 pin of the X2 connector.

Controller Registers

System Registers

Main article: CANNY 7, System Registers

System resources are divided into an address group of input registers and an address group of output registers. By accessing these registers from the function diagram you can receive useful information about the current status of the controller, and control its operating mode. The set of system registers is located in the “System Registers” folder of the CannyLab IDE registers list. The list is accessible via “Input Register” and “Output Register” context menu options in the editor.

Discrete Inputs and Outputs

Main article: CANNY 7, Discrete IO Driver

CANNY 7 gives you access to eleven discrete general purpose IO channels. Each channel is physically accessed through a corresponding pin of X2(Channels 0..7) and X3(Channels 8..10) connectors. By writing and reading data of the respective driver registers, the functional diagram can manage the electric potential in each of these contacts, as well as get information about the current potential of each of them.

The physical characteristics of these channels allow them to be connected to a variety of external devices. Channels 0..7 can be used to work with any type of load, for example: electromagnetic relays, small electric motors, LEDs, low current systems. Channels 0..8 can only be used to work with resistive and capacitive loads. You can use a variety of input signal sources, such as: mechanical, electromechanical, and electronic buttons and switches, pulse generators, voltage source 0-12V, transistor outputs of various equipment, etc.

Channel operation mode and parameters are set via the function diagram. At any given moment in time, the channels can only work in one of the possible modes, but it is possible to dynamically override the channel configuration from the function diagram.

High Resolution PWM

Main article: CANNY 7, HR PWM Driver

Two of eleven IO channels (Channel №1 and №2) CANNY 7 can work in high-resolution pulse-width modulator mode. The channels may be activated independently of each other and also have an independently configured duty cycle and line pull-up. However, the high-resolution PWM period is configured for both channels simultaneously. In HR PWM mode, the PWM timing parameters - the period and duty cycle can be set in the range from 2 to 20000 microseconds, in 1 microsecond increments.

An HR PWM channel has a fixed pulse polarity - GND 100mA. Generation can be done in either open collector (no pull-up or external pull-up) mode or internal pull-up mode to +12V (specified by setting value in the appropriate register). In this mode, the channel is asynchronous to the function diagram, which allows for maximum stability of generated signal timing parameters.

HR PMW driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the HR PMW driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.

Note: When a channel is set to the high-resolution pulse width modulator the electrical short circuit protection for the channel is disabled! Overload or short circuit of a channel set to this mode can cause damage to the controller!

UART / RS232 / Modbus driver

Main article: CANNY 7, UART Driver

CANNY 7’s IO channels #9 and #10 support UART and RS-232 serial protocols for receiving/transmitting data. It may be used to connect the controllers with each other or with external equipment supporting this communications protocols. The channels may be activated independently of each other and have individual data speed setting, protocol type and configuration, pull up line.

Size of receive and transmit buffers for each of the interfaces of the CANNY 7.2 Duo UART driver is 32 bytes.

UART implementation in CANNY 7 controllers enables serial data reception and transmission over a single wire in half-duplex mode. Thus CANNY 7 may have two independent connections when using the UART protocol. Monitoring of the data link status is done from the function diagram. If the channel is free, the device may start data transmission, otherwise the device should wait for the line release.

RS-232 implementation, by using both UART data channels, enables the exchange of data with other RS-232 devices in duplex mode, i.e. one channel is used to send data, while the other is used to simultaneously receive data.

Modbus protocol in CANNY 7 controllers is implemented both over UART or over RS-232. A compact binary variant called Modbus RTU is used as the ADU (Application Data Unit). Checking the data integrity is done via the automatically calculated checksum (CRC). Package size is limited to 32 bytes including the CRC.

UART / RS232 / Modbus driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the UART/RS-232/Modbus driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.

CAN driver

Main article: CANNY 7, CAN Driver

CAN-H and CAN-L are specialized external terminals of the CANNY 7 controller, located on pins 1 & 2 of the X1 connector. They are designed to connect to to the CAN-bus. The driver enables you to receive and send data over the CAN bus.

LIN driver

Main article: CANNY 7, LIN Driver

Channels 9 and 10 can be used to organize data reception and transmission as two independent LIN driver channels.

LIN driver channels can be connected both in tandem and individually. They have individual settings for baud rate, pull-up line and bus node type - MASTER or SLAVE.

LIN driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the LIN driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.

I²C driver

Main article: CANNY 7, I²C Driver

Communication lines (SDA and SCL) can be assigned to any pair of CANNY 7 controller channels. At the same time, these channels should be pulled-up from the outside to 5V using resistors 1 - 10k Ohm. The distinction of I²C protocol implementation is that the CANNY 7 controller can act only as a Master node. Data exchange between devices, that can be both mono- and bi -directional and takes place in separate sessions, i. e. opening multiple sessions with different devices is not allowed. The maximum length of the message within one I²C session is 16 bytes. Exchange rate is fixed to 100 kbit/s. The total number of slave devices on the line can reach several tens.

I²C driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the I²C driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.

Dallas 1-Wire driver

Main article: CANNY 7, Dallas 1-Wire Driver

CANNY 7 controller can be used as a MASTER in a single-wire data network Dallas 1-Wire®.

All CANNY 7 input-output channels can be used to connect the controller to 1-Wire bus. At the same time, that channel must be externally pulled-up to 5V with a 3-7k Ohm resistor. Depending on the specific mode(defined through the function diagram), the CANNY 7 implementation makes it possible to communicate with a specific device through the 1-Wire bus by using the device address. This enables the controller to work with several SLAVE devices through one channel. It’s also possible to perform a serial connection of the controller to several 1-Wire buses. In other operating modes device addressing and device handling by address is not available, therefore you will only be able to connect to one SLAVE node per channel.

Dallas 1-Wire driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the Dallas 1-Wire driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.

User Preprogrammed Parameters

Main article: CANNY 7, User Preprogrammed Parameters

The custom configuration parameters can be specified by the end user when loading software into the controller using SFX-files. After uploading software and running the controller in standalone mode, parameters set by user become available in the function diagram within the relevant controller registers list folder.

Proper use of user-defined parameters significantly increases the flexibility and versatility of controller-based solutions, enabling the end user to make safe changes in controller operation algorithm, using a simple user interface, bypassing the need for teaching them how to work with CannyLab.

EEPROM Non-volatile Memory

Main article: CANNY 7, EEPROM Driver

To eliminate loss of critical information (controller’s state, external device status, etc.) in case of a power failure, the CANNY 7 controller is equipped with non-volatile memory. The values saved in EEPROM will be available in special registers after the power is restored.

There are 64 16-bit non-volatile memory cells, which are accessed by using the corresponding input and output registers.

Note: Working with non-volatile memory does not require any special pre-configuration.

Infrared Remote Control Driver

Main article: CANNY 7, IRRC Driver

CANNY 7 controller can receive and send infrared remote controls commands (IRRC) in several widely-used formats - NEC, extended NEC, Samsung, Sony. Driver operation is possible in three modes: reception only, transmission only or reception / transmission. For transmission and reception any two channels can be used.

When transmitting infrared remote control commands, the channel used for this only generates baseband signal. To generate a pulse packet, the controller requires a carrier frequency, the source of which can be either an internal high frequency PWM channel or an external PWM generator. Receiving IR commands requires an external demodulator, such as TSOP1736 or similar.

IRRC driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the IRRC driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.


Electrical characteristics and environmental requirements

Electrical characteristics and environmental requirements.
Parameter Value
Supply voltage 9…18 V
Current consumption: in run mode (upper limit) 55 mА
Current consumption: in power saving mode (upper limit) 5.5 mА
The maximum current of each channel in output mode +120 mA / -120 mA
Channel resistance in input mode 4 K or 200 K
Operating temperature range 40°С…+85°С
Ingress Protection Rating IP50

Electrical circuit protections:

  • from channel short-circuit - software;
  • from channel overload - internal current-limiting fusible resistors;
  • from power supply polarity reversal - internal diode;
  • high emissions suppression circuit during inductive loads switching on channels №0 to №7 - diode and varistor;
  • high emissions suppression circuit during inductive loads switching on channels №8 to №10 — none.

Safety Precautions

The circuits of the controller do not have life-threatening voltage. Controller open terminals are under voltage during operation. Any connections to the controller as well as maintenance are to be done only with the power off to both the controller and connected devices.

Installation and connection

Installation and connection of the controller must be carried out only by qualified personnel who studied this documentation. Controller installation must be carried out in conditions suitable to operation of the controller.

Do not allow moisture to come in contact with output terminals and internal elements of the controller. It is forbidden to use the controller in the presence of ambient acids, alkalis, and other corrosive substances in the air.

Installing the controller and laying cables connected to it must be done at a distance of no less than 0.3 meters from high-voltage power lines and strong electromagnetic sources - power relays, contactors, gas discharge lamps. Avoid getting moisture on the controller enclosure at the installation site.

Transportation and storage

Controllers may be transported by all types of covered transportation . Place and secure the shipping container with packed devices in vehicles in such a way as to provide their stable position and to prevent movement during transport.

Transportation and storage should be carried out at ambient temperatures from -40 to +85 ° C and relative humidity - up to 80%, compliance with security measures of protection from shock and vibration. The air must not contain acids, alkalis and other aggressive substances. Controllers should be stored on shelves.