Good afternoon. The program FLProg since version 2.1. appeared blocks menu. In this lesson we will create a menu using the data blocks.
That would be more interesting to consider the real-world task. Collect a temperature control unit, which will include a temperature sensor, a heater and a fan. Additionally, the inclusion of a fan or heater will be accompanied by an audible signal. Menu will be to set thresholds on and off devices and the need of a sound signal. For easier debugging the temperature sensor to start going to simulate with a variable resistor.
The first variant of the device will consist of:
LCD Keypad Shield
The two relay blocks:
Here is a schematic diagram of the device
To start the whole project.
This Board analyzes the signal of the buttons on LCD Keypad Shield and are formed corresponding signals. The analysis is performed using the user unit 5Bin1. The creation of this unit covered in this lesson, there you can download this block.
Since the buttons on the Silde is not enough, let’s add functionality to the “Select” button.
On this Board a signal is generated activating the menu. Timer TON necessary to protect against the accidental formation of this signal at the start of the controller. Well, just charge with the main menu block.
Tab “Menu Tree”
The tree menu consists of two menu groups of settings for temperature on and off of the heater and ventilation, as well as single point to control the activity of sound. In General this unit allows you to build menus of any complexity and nesting. The main thing that would be enough controller memory.
Configure group menu item.
A little bit more precise about the starting values in the EEPROM. This value is recorded in the EEPROM at the beginning of the first cycle after the program is loaded into the controller. This will only happen once after each new loading of the program into the controller. Other menu items associated with a temperature similar to this.
Settings menu sound control:
Tab – “Control of menu”:
Tab – “Controlof value”
The mode changes when you short press the button change the value it changes the value of a given step. If you hold this button more than 2 seconds the value will change by the amount specified step every half second. If you continue to hold the button for 2 seconds, the period value changes will be reduced to 200 ms.
Pay attention only to the inputs CanValUp units MenuValue. At a high level on this input value at the output Q corresponds to the value of the selected menu item. On the falling edge on this input value is “frozen” before the advent of this high level. This is necessary to ensure that the value does not change until the end you edit it (close the menu).
The remaining fee simple and need no explanation.
Now a little “bleed” project. Replace LCD Keypad Shield for 4×4 keypad matrix and 4×20 display connected via I2C.
This will allow you to set value is not step by step, and by simply entering the numbers. In addition this will make to enter the menu password. Modified scheme of the project.
The entire project.
Uses a standard survey unit matrix keypad library elements.
This menu consists of one item, an employee for a password. Used type Long Integer, to increase the number of characters of the password.
This Board is of the correct password. The coincidence of the password entered and saved in the main menu activates the main menu. When you exit the menu to enter the password is written to 0 (to prepare for next input)
The control value is translated to a direct input of digits. The other Board has not changed.
The use of a resistor as reference temperature useful for debugging, but in real application still required a temperature sensor. Use a temperature sensor DS18B20. To do this, you must change the first cost of both projects.
Block “ScanOneWare” is used to automatically determine the address of the sensor. This enables you to replace if necessary temperature sensor without flashing the controller.