Menu

Large number of Code Lines - Navigate to Main Loop

Help
2022-08-03
2022-08-07
  • Jeff Weinmann

    Jeff Weinmann - 2022-08-03

    Hello,

    I have many lines of code with several Dimensions, Defines and Comments along with large sub routines. Is there a way to bookmark the Main Loop Area and somehow navigate to it like you would a sub routine? on the left in the IDE?

    thanks,

    Jeff

     
  • Anobium

    Anobium - 2022-08-03

    Yes.

    In GCSTUDIO you can collapse all the code to just show the Sub/Functions etc. This can be automatically or section by section. GCSTUDIO remembers the state when you open and close the file.

    In SynWrite. You can collapse sections but the state is not remembered.

     
  • William Roth

    William Roth - 2022-08-03

    You could add a label called MainLoop: on the line preceding the start of the main loop. This label will show up in the Tree Panel in Synwrite. Double Click on it and it will take you to the start of the main control loop. Should work in a similar manner with GCSTUDIO/GCCode

    Example:

    MainLoop:
         Do
                PWM1_1_DUTY = SCALE (READAD12(ANA0), 0, 4095, 2136, 5880)  ;Servo 1
                PWM1_2_DUTY = SCALE (READAD12(ANA1), 0, 4095, 2136, 5880)  ;Servo 2
         Loop
    

    William

     

    Last edit: William Roth 2022-08-03
    • mkstevo

      mkstevo - 2022-08-04

      That is my preferred method for large programs. Works in Geany's tree explorer too.

       
    • Jeff Weinmann

      Jeff Weinmann - 2022-08-07

      Thanks I tried your method and got rid of my sub main. Much more elegant!

      MainLoop:
      Do Forever...

      Thanks!

       
  • Jeff Weinmann

    Jeff Weinmann - 2022-08-05

    I ended up placing the main loop in a Sub routine called Main. It is now listed at the top and is very easy to access!

    Main()

    Sub Main()

        Do Forever
    
            .......
    
         Loop
    

    End Sub

     

Log in to post a comment.