C,
You can use the same program for the Elev as the Azim for capturing the ElevVal, the Elev angle is already parsed from the A123E123 string.
Change the Limits
eg: instead of testing 180.0 deg for Azim to 'drive the shortest direction' use
000 Poscnt as the lowest Downward head tilt as
-40 deg and the Upward tilt as
+90 deg
[you do some Maths , so actual 000 Poscnt = -400 deg , 1300 = 900 deg]
also change the CAP3BUL/H pre-load from 3599 to 40+90 ie: 1300
The Azim compares should be Elev compares
I have built the 18F2431 circuit and will now add my 900 counts/rev encoder, so I have to change the limits to 18000 and 35999 for my further tests.
It will include the PWM drive signals, using Red/Blue LED's as CW or CCW indication for my testing ONLY, will post when ready.
[ Trying to get some bedding plants into the garden while its fine weather ]
Do you follow that OK.?
E