This documentation is out of date.
The new version of the documentation is here: https://cannylogic.com/docs |
Difference between revisions of "CANNY 5.2 duo, System Registers"
[unchecked revision] | [unchecked revision] |
(→Built-in LED) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 49: | Line 49: | ||
|} | |} | ||
<br clear="all"> | <br clear="all"> | ||
+ | |||
+ | == Built-in LED == | ||
+ | |||
+ | The controller has a built-in bi-color (green/red) LED. The functional diagram controls switching-on of each color by writing specific values into the appropriate registers. | ||
+ | |||
+ | {|border="1" style="border-collapse:collapse;" align="left" width="100%" | ||
+ | |- align="center" valign="top" | ||
+ | !width="250px"|Address | ||
+ | !Expected values | ||
+ | |- valign="top" | ||
+ | |style="padding-left:0.5em;"|Green LED On/Off Register | ||
+ | | | ||
+ | {|border="0" align="left" | ||
+ | |- valign="top" | ||
+ | |width="70px" style="padding-left:0.5em;"|≥ 1 | ||
+ | |style="padding-left:0.5em;"|= | ||
+ | |style="padding-left:0.5em;"|turn-on built-in Green LED | ||
+ | |- valign="top" | ||
+ | |width="70px" style="padding-left:0.5em;"|0 | ||
+ | |style="padding-left:0.5em;"|= | ||
+ | |style="padding-left:0.5em;"|turn-off built-in Green LED | ||
+ | |} | ||
+ | |- valign="top" | ||
+ | |style="padding-left:0.5em;"|Red LED On/Off Register | ||
+ | | | ||
+ | {|border="0" align="left" | ||
+ | |- valign="top" | ||
+ | |width="70px" style="padding-left:0.5em;"|≥ 1 | ||
+ | |style="padding-left:0.5em;"|= | ||
+ | |style="padding-left:0.5em;"|turn-on built-in Red LED | ||
+ | |- valign="top" | ||
+ | |width="70px" style="padding-left:0.5em;"|0 | ||
+ | |style="padding-left:0.5em;"|= | ||
+ | |style="padding-left:0.5em;"|turn-off built-in Red LED | ||
+ | |} | ||
+ | |} | ||
+ | |||
+ | {| | ||
+ | |valign="top" style="padding-left:0.5em;"|''Note:'' | ||
+ | |valign="top" style="padding-left:0.5em;"|''Turning the LED simultaneously in both colors is unavailable, so if functional diagram set simultaneous switching on of Red and Green LEDs, the LED turns green only (green priority).'' | ||
+ | |} | ||
+ | |||
+ | A functional diagram fragment, which turns on built-in Red LED for one second after each controller reset. | ||
+ | |||
+ | [[File:14_5_3_1.png]] | ||
+ | <br clear="all"> | ||
+ | |||
+ | == Hibernation == | ||
+ | |||
+ | After reset, the controller starts working in normal power consumption, functional diagram will be executed continuously. Transition to Hibernation Mode carried out by command of functional diagram, recording a non-zero value to "Sleep Mode Enable Register". Transition to Sleep Mode takes place immediately after the end of functional diagram execution cycle, in which such recording was made, in the absence of conditions that impede this transition. | ||
+ | |||
+ | The duration of "sleep" phase can be set from the functional diagram by writing a value to the address "Sleep Mode Time Scale Register". By default, if the functional diagram has no entry in the corresponding register, the "sleep" phase of hibernation mode lasts 1024ms. This means that while controller in low power mode, in the absence of conditions for transition to the normal power, the controller makes a pause of 1 second after each execution cycle of functional diagram. | ||
+ | |||
+ | |||
+ | {|border="1" style="border-collapse:collapse;" align="left" width="100%" | ||
+ | |- align="center" valign="top" | ||
+ | !width="250px"|Address | ||
+ | !Expected values | ||
+ | |- valign="top" | ||
+ | |style="padding-left:0.5em;"|Sleep Mode Enable Register | ||
+ | | | ||
+ | {|border="0" align="left" | ||
+ | |- valign="top" | ||
+ | |width="70px" style="padding-left:0.5em;"|≥ 1 | ||
+ | |style="padding-left:0.5em;"|= | ||
+ | |style="padding-left:0.5em;"|go into low power mode | ||
+ | |- valign="top" | ||
+ | |width="70px" style="padding-left:0.5em;"|0 | ||
+ | |style="padding-left:0.5em;"|= | ||
+ | |style="padding-left:0.5em;"|return to normal power mode | ||
+ | |} | ||
+ | |- valign="top" | ||
+ | |style="padding-left:0.5em;"|Sleep Mode Time Scale Register | ||
+ | | | ||
+ | {|border="0" align="left" | ||
+ | |- valign="top" | ||
+ | |width="70px" style="padding-left:0.5em;"|0...65535 | ||
+ | |style="padding-left:0.5em;"|= | ||
+ | |style="padding-left:0.5em;"|duration of "sleep" phase in milliseconds after each execution cycle of functional diagrams | ||
+ | |} | ||
+ | |} | ||
+ | |||
+ | Returning controller to normal power can be done manually - immediately after the end of the execution cycle of functional diagrams, during which it was written "0" at "Sleep Mode Enable Register", or automatically by any of the following events: | ||
+ | *with changing of the electric potential in any terminal with the appropriate controller channel, configured as an active input or pulse counter; | ||
+ | *when enabled from the functional diagram of any of the drivers CAN, LIN, UART/RS232, IR or Elita GSW with changing of the electric potential on the corresponding drivers' terminal. | ||
+ | |||
+ | Information on the current power mode is available when accessing the address "Sleep Mode Control Register" | ||
+ | |||
+ | {|border="1" style="border-collapse:collapse;" align="left" width="100%" | ||
+ | |- align="center" valign="top" | ||
+ | !width="250px"|Address | ||
+ | !Return Values | ||
+ | |- valign="top" | ||
+ | |style="padding-left:0.5em;"|Sleep Mode Control Register | ||
+ | | | ||
+ | {|border="0" align="left" | ||
+ | |- valign="top" | ||
+ | |width="70px" style="padding-left:0.5em;"|1 | ||
+ | |style="padding-left:0.5em;"|= | ||
+ | |style="padding-left:0.5em;"|controller is in Sleep Mode | ||
+ | |- valign="top" | ||
+ | |width="70px" style="padding-left:0.5em;"|0 | ||
+ | |style="padding-left:0.5em;"|= | ||
+ | |style="padding-left:0.5em;"|controller is in Normal Mode | ||
+ | |} | ||
+ | |} | ||
+ | |||
+ | {| | ||
+ | |valign="top" style="padding-left:0.5em;"|''Note:'' | ||
+ | |valign="top" style="padding-left:0.5em;"|''When creating a functional diagram, using low-power mode should be considered as a side effect brought by the change in the time scale. This effect manifests itself in functional blocks increment time: delay start, stop and PWM generators in a low power mode occurs in leaps and bounds according to the time actually spent in the phase of "sleep" (default 1000 ms increments).'' | ||
+ | |} | ||
+ | |||
+ | A fragment of a functional diagram with typical low-power mode control: transition to the low power mode in the absence within 10 seconds conditions preventing it and automatic return to normal mode doe to controller periphery activity or set ban to "sleep" from the diagram: | ||
+ | |||
+ | [[File:6_5_4_1.png]] | ||
+ | |||
+ | {| | ||
+ | |valign="top" style="padding-left:0.5em;"|''Note:'' | ||
+ | |valign="top" style="padding-left:0.5em;"|''Inversion of the output of the function block №4.'' | ||
+ | |} |
Latest revision as of 12:05, 19 December 2016
General description
System resources are divided into an address group of read registers and an address group of write registers. Referring to the given registers from the functional diagram, you can get demanding information for practical application about the current status of the controller, and control its operation mode. The set of system registers located in the "System Registers" directory of CannyLab IDE registers list, which is available via "Input Register" and "Output Register" context menu.
Reset controller
Controller reset occurs as a result of any of the three events: when power up the controller, soft reset from the functional diagram. The controller is initialized after reset: the entire memory contents is cleared, input-output channels are reset to a neutral state, system software drivers are transferred to the initial state, power consumption is set to normal, a functional diagram execution starts from the beginning. The non-volatile memory content does not change at reset.
Information about the reset is available by accessing the address "Power On Detect Register"
Address | Return Values | ||||||
---|---|---|---|---|---|---|---|
Power On Detect Register |
|
Forced reset of the controller is performed by writing a nonzero value to "Reset Register" address. In this case, the controller reset takes place immediately after the end of the execution cycle of functional diagram, in which there was such a record.
Address | Expected values | ||||||
---|---|---|---|---|---|---|---|
Reset Register |
|
Built-in LED
The controller has a built-in bi-color (green/red) LED. The functional diagram controls switching-on of each color by writing specific values into the appropriate registers.
Address | Expected values | ||||||
---|---|---|---|---|---|---|---|
Green LED On/Off Register |
| ||||||
Red LED On/Off Register |
|
Note: | Turning the LED simultaneously in both colors is unavailable, so if functional diagram set simultaneous switching on of Red and Green LEDs, the LED turns green only (green priority). |
A functional diagram fragment, which turns on built-in Red LED for one second after each controller reset.
Hibernation
After reset, the controller starts working in normal power consumption, functional diagram will be executed continuously. Transition to Hibernation Mode carried out by command of functional diagram, recording a non-zero value to "Sleep Mode Enable Register". Transition to Sleep Mode takes place immediately after the end of functional diagram execution cycle, in which such recording was made, in the absence of conditions that impede this transition.
The duration of "sleep" phase can be set from the functional diagram by writing a value to the address "Sleep Mode Time Scale Register". By default, if the functional diagram has no entry in the corresponding register, the "sleep" phase of hibernation mode lasts 1024ms. This means that while controller in low power mode, in the absence of conditions for transition to the normal power, the controller makes a pause of 1 second after each execution cycle of functional diagram.
Address | Expected values | ||||||
---|---|---|---|---|---|---|---|
Sleep Mode Enable Register |
| ||||||
Sleep Mode Time Scale Register |
|
Returning controller to normal power can be done manually - immediately after the end of the execution cycle of functional diagrams, during which it was written "0" at "Sleep Mode Enable Register", or automatically by any of the following events:
- with changing of the electric potential in any terminal with the appropriate controller channel, configured as an active input or pulse counter;
- when enabled from the functional diagram of any of the drivers CAN, LIN, UART/RS232, IR or Elita GSW with changing of the electric potential on the corresponding drivers' terminal.
Information on the current power mode is available when accessing the address "Sleep Mode Control Register"
Address | Return Values | ||||||
---|---|---|---|---|---|---|---|
Sleep Mode Control Register |
|
Note: | When creating a functional diagram, using low-power mode should be considered as a side effect brought by the change in the time scale. This effect manifests itself in functional blocks increment time: delay start, stop and PWM generators in a low power mode occurs in leaps and bounds according to the time actually spent in the phase of "sleep" (default 1000 ms increments). |
A fragment of a functional diagram with typical low-power mode control: transition to the low power mode in the absence within 10 seconds conditions preventing it and automatic return to normal mode doe to controller periphery activity or set ban to "sleep" from the diagram:
Note: | Inversion of the output of the function block №4. |