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
|
1
|
=
|
the current execution cycle is the first one, since a soft reset or restored power
|
0
|
=
|
the current execution cycle is not the first one, since a soft reset or restored power
|
|
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
|
≥ 1
|
=
|
start a forced controller reset
|
0
|
=
|
value is ignored
|
|
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
|
≥ 1
|
=
|
turn-on built-in Green LED
|
0
|
=
|
turn-off built-in Green LED
|
|
Red LED On/Off Register
|
≥ 1
|
=
|
turn-on built-in Red LED
|
0
|
=
|
turn-off built-in Red LED
|
|
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.