debugging_complex_programs
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
debugging_complex_programs [2021/01/19 13:55] – [Project initialization] emozolyak | debugging_complex_programs [2021/08/02 10:41] – [Differences between write function for internal registers and external] emozolyak | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | |||
====== Debugging complex scripts ====== | ====== Debugging complex scripts ====== | ||
===== Project initialization ===== | ===== Project initialization ===== | ||
- | ===== Proper commenting ===== | + | |
- | Use commenting you will understand next time you or someone will see you code. | + | |
- | <code lua> | + | |
- | ----------------------------------------CALC. DAY ECONOMY -------------------------------------------------- | + | |
- | LimitMonthDayYesterday = GetReg(" | + | |
- | HeatEnergyDay= GetReg(" | + | |
- | WriteReg(" | + | |
- | ------------------------------------------------------------------------------------------------------------ | + | |
- | </ | + | |
Line 39: | Line 33: | ||
Remember that registers such as Dxx, CDxx and other internal registers, except for DSxx, return to the initial state (usually 0) after initializing the project (which happens when editing project elements - scripts, registers, connections, | Remember that registers such as Dxx, CDxx and other internal registers, except for DSxx, return to the initial state (usually 0) after initializing the project (which happens when editing project elements - scripts, registers, connections, | ||
- | ===== Differences between write function for internal | + | ===== Differences between write function for internal/external |
There are some differences in the operation of the SetReg and WriteReg functions with respect to internal registers (Dxx, DSxx). These functions directly change the values of the internal registers inside the scan, and do not delay WriteReg writing to the next scan start. Thus, at the end of the scan, the internal register can have a value different from the one at the scan input. Then, for example, a situation is possible where: | There are some differences in the operation of the SetReg and WriteReg functions with respect to internal registers (Dxx, DSxx). These functions directly change the values of the internal registers inside the scan, and do not delay WriteReg writing to the next scan start. Thus, at the end of the scan, the internal register can have a value different from the one at the scan input. Then, for example, a situation is possible where: | ||
Line 67: | Line 61: | ||
It is recommended that you split complex scripts into simpler and more frequently used functions that you can reuse. Dividing tme into simpler parts, arranging them in the right order and grouping helps to control the logic of the system and makes it easier to set up the system. | It is recommended that you split complex scripts into simpler and more frequently used functions that you can reuse. Dividing tme into simpler parts, arranging them in the right order and grouping helps to control the logic of the system and makes it easier to set up the system. | ||
+ | |||
+ | ===== Proper commenting ===== | ||
+ | Use commenting you will understand next time you or someone will see you code. | ||
+ | <code lua> | ||
+ | ----------------------------------------CALC. DAY ECONOMY -------------------------------------------------- | ||
+ | LimitMonthDayYesterday = GetReg(" | ||
+ | HeatEnergyDay = GetReg(" | ||
+ | WriteReg(" | ||
+ | ------------------------------------------------------------------------------------------------------------ | ||
+ | </ | ||
debugging_complex_programs.txt · Last modified: 2022/01/15 20:50 by 127.0.0.1