PrintMainProgramHz

Purpose: Print the number of times the main() system loop executed during the the prior second.
Assumes:   Nothing.
Passed: Nothing.
Returns: R23:R22   WORD   wLastHz   the wTixLastSecond value that was printed
Alters: R18, R20, R21, the FLAGs (SREG) and the COM1 Transmit buffer
Example:  
.ORG   0x1000

   JMP     APrintMainProgramHz    ; Also prints Carriage Return and Line Feed
Test it:
m>@ 4096        ; Using copy and paste:
Main program Hz: 2,417
m>@ 4096
Main program Hz: 2,420
m>@ 4096
Main program Hz: 2,420
m>@ 4096
Main program Hz: 2,413
m>@ 4096
Main program Hz: 2,413
m>@ 4096
Main program Hz: 2,413
m>@ 4096
Main program Hz: 2,410
m>@ 4096
Main program Hz: 2,410
m>@ 4096
Main program Hz: 2,421
m>                ; No need to be logged in for this alternative
>E 4 ^= 16        ; Toggle BIT_RTC_SEC_PRG_HZ in EEbFlags_RTC
>Main program Hz: 2,409
Main program Hz: 2,420
Main program Hz: 2,419
Main program Hz: 2,424
Main program Hz: 2,419
Main program Hz: 2,420
Main program Hz: 2,424
Main program Hz: 2,419
Main program Hz: 2,420
Main program Hz: 2,419
Main program Hz: 2,424
Main program Hz: 2,420
Main program Hz: 2,419
E 4 ^= 16
>                                                                                          
Notes: Note in the example above that the very same value was reported on two or three lines when the calls were made in quick succession. That is not an error.
The main() loop count totalizer is stored in R3:R2 and, as would be expected, incremented each pass through the main() loop.
When the system clock milliseconds counter rolls past one thousand (1,000) milliseconds, it increments ulT0_Seconds, the value in R3:R2 is moved to wTixLastSecond, and R3:R2 is reset to zero. This is an Operating System feature which cannot be disabled.
The System WORD Variable wTixLastSecond is maintained at address 0x01D6 in SRAM.
If the number of loops through main() so far during the current second is desired, simply read the WORD value in R3:R2.
Dropin: 
(setup
code)
;   Setup for the PrintMainProgramHz() call:
; Passed:  Nothing.
; Returns: R23:R22  WORD wLastHz the wTixLastSecond value that was printed
; Alters:  R18, R20, R21, the FLAGs, and the COM1 Transmit Buffer
Also see:   The PrintAllAINs and PrintScriptProgramHz System Functions.
The BIT_RTC_SEC_PRG_HZ BIT in EEbFlags_RTC causes this function to be called automatically once each second.