hi C,
I see in your program the toggle led is just after the get_count: .?
Which means the POSCNT and AZIMVAL counts are never matching, this could be due to a number of things.
I would suggest that you add an HSEROUT just after the Toggle and output the POSCNT and AZIMUTH values.
eg: Hserout "P=",#poscnt, " A=", #azimval, crlf
Post the values that you see when the PIC locks up.
Also note there is a remmed out ''Hserout "Ix=", #azimval, " ", #poscnt, CrLf in the High ISR, that should output those values when a MATCH occurs, you unrem that and see if you ever get a MATCH.
Lets know.
Eric