Need help with "Clunky Code"
I have been working (on and off) on a project that used a serial out electronic inclinometer to calculate elevation. Stage two was to use a Grayhill 2-bit optical encoder to count the rotations of a large jack screw . The results of both routines are displayed real-time on a 2x16 serial LCD display. Each result having its own line on the display.
Each routine works fine on its own my problem exists during the merge. I seem to be missing optical encoder counts b/c the inclinometer takes too long to execute thus causing rotation count errors.
Could someone give me an option on this, it would be much appreciated.
GC3076
Each routine works fine on its own my problem exists during the merge. I seem to be missing optical encoder counts b/c the inclinometer takes too long to execute thus causing rotation count errors.
Could someone give me an option on this, it would be much appreciated.
GC3076

Comments
gc3076, your DO...LOOP GOSUBs to "EL"; "EL" GOSUBs to "Get_Spec_Tilt", at the start, but "EL" does not have a RETURN following its SEROUT instruction, so it is proceeding to "Get_Spec_Tilt", as allanlane5 noted.
DO [color=green]GOSUB EL [/color] GOSUB AZ LOOP [color=green]EL: [/color] GOSUB Get_Spec_Tilt angle = angle * 10 ** 22446 angle = angle - 7014 SEROUT LcdPin, LcdBaudMode, [noparse][[/noparse]Line0, "EL "] IF angle.BIT15 = 1 THEN SEROUT LcdPin, LcdBaudMode, [noparse][[/noparse]"-"] ELSE SEROUT LcdPin, LcdBaudMode, [noparse][[/noparse]" "] ENDIF SEROUT LcdPin, LcdBaudMode, [noparse][[/noparse]DEC2 ABS(angle) / 100, ".", DEC2 ABS(angle) // 100, 0] [color=red]RETURN ' It seems you need THIS or it'll do another Get_Spec_Tilt (which immediately follows)[/color]▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
My last words shall be - "NOT YET!!!"