Yep, something like that
I took a closer look at your code to find an endless loop but I can't find any
Starting from "Main" you do 4 calls
Last call to "Wait" to wait for four pulses then things go wrong
Your "Loop" code is even wrong since:
1) There is no jump to "Loop"
2) You jump to "Clear_LCD" should be a Call because I don't know what happen on the "ret" at the end of the "Clear_LCD" routine. There is nothing to return to.
You absolutely need more structure in your code
Check the attached file.
I think it has a good structure for your application.
Just add all the code specific for your µC at the start (Part 1).
And all the code at the end (Parts 5 to 8) to calculate and display things.
The µC continously executes Part 2 and jumps to specific code according to some bits set by the ISR's.
Don't know if the reload thing is needed at the start ot the timer ISR, depend on timer used and µC: check the datasheet.
Don't know if your assembler will accept all these things mine does
Try to understand the principle, the structure, the idea, ... and translate it for your assembler.
Use the "segment", "ds" , "dbit" , ... directives to reserve some space, your assembler / relocater / linker (call it like you want) will allocate specific addresses to them.
Never do what someone else can do four you