It's definitely possible, but not quite the way you are trying it.

Take a look at your loops "CHECK" and "THR". After a 1mS pause you go right into the first one and you will wait there FOREVER if CT never happens. Same for the second one.

Your counter "For A =" is NOT incrementing while you are stuck in those nested loops. Remember that those instructions don't multitask. Only one instruction will happen at a time.

You aren't too far off, but things are not in the right sequence. Try doing a flowchart of your code first.

P.S. The PIC does not need 20 seconds to "stabilize"! Heavens to Mergatroid! Only your grandpa's TV ever needed that kind of warm-up. LOL.