User Tools

Site Tools


debugging_complex_programs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
debugging_complex_programs [2021/01/19 13:57] – [Proper commenting] emozolyakdebugging_complex_programs [2022/01/15 20:50] (current) – ↷ Links adapted because of a move operation 127.0.0.1
Line 33: 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, etc.). If such registers are used as variables to generate event triggers or conditions for executing other scripts, this can lead to a violation of the execution logic. You should consider this feature when choosing registers as input and output script variables. 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, etc.). If such registers are used as variables to generate event triggers or conditions for executing other scripts, this can lead to a violation of the execution logic. You should consider this feature when choosing registers as input and output script variables.
  
-===== Differences between write function for internal registers and external =====+===== Differences between write function for internal/external registers =====
  
 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 67:
 ----------------------------------------CALC. DAY ECONOMY -------------------------------------------------- ----------------------------------------CALC. DAY ECONOMY --------------------------------------------------
     LimitMonthDayYesterday = GetReg("LimitMonthDayYesterday1"             -- Yesterday's limit     LimitMonthDayYesterday = GetReg("LimitMonthDayYesterday1"             -- Yesterday's limit
-    HeatEnergyDay= GetReg("HeatEnergyDay"                                 -- Heat qty. for yesterday+    HeatEnergyDay = GetReg("HeatEnergyDay"                                -- Heat qty. for yesterday
     WriteReg("SavingDay1", (LimitMonthDayYesterday - HeatEnergyDay))        -- Economy for the day                               WriteReg("SavingDay1", (LimitMonthDayYesterday - HeatEnergyDay))        -- Economy for the day                          
 ------------------------------------------------------------------------------------------------------------  ------------------------------------------------------------------------------------------------------------ 
 </code> </code>
  
 +===== Step over trick =====
 +
 +When you need to run once your script and inspect its result in the console, you can do this as follows:
 +  *make extra bit register, like "Debug step over bit"
 +  *change run mode of the script being debugged - execute upon the register's (you've created in the previous step) change 
 +
 +{{ network:2021-08-02_13-51-50.gif?nolink |}}
  
  
  
  
debugging_complex_programs.1611064636.txt.gz · Last modified: 2021/01/19 13:57 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki