Page 141 - Build Your Own Quadcopter_ Power Up Your Designs with the Parallax Elev-8
P. 141

120     Bu il d  Y o ur  O w n  Q u a d c o p t e r


                                             mov     counter,cnt      ‘Store the current system

                                                                              address
                                             mov     outa,AllOn       ‘Set all pins on this cog


                                                                                  inputs)
                                             add     counter,HighTime ‘Add “HighTime” value to
                                                                            value
                                         waitcnt     counter,LowTime  ‘Wait until “cnt” matches


                                             mov     outa,#0          ‘Set all pins on this cog


                                                                                inputs)
                                          waitcnt   counter,0         ‘Wait until cnt matches

                                                                            afterwards)
                                             jmp    #Loop             ‘Jump back up to the cell

                             ‘Constants and Variables:
                             ServoPin        long   |< Servo_Pin      ‘This sets the pin that


                                                                              servomotors).
                             AllOn          long     $FFFFFFFF        ‘This will be used to set

                             LowTime        long     1_600_000        ‘This is a 20ms pause time
                                                                                  clock.
                             counter         res                      ‘Reserve one long of cog

                                                                          variable
                             HighTime        res                      ‘Reserve one long of cog

                                                                          variable
                                             fit                      ‘Makes sure the preceding

                                                                                  RAM

                             {{Copyright (c) 2008 Gavin Garner, University of Virginia
                             Single_Servo_Assembly
                                 MIT License: Permission is hereby granted, free of charge, to any person obtaining a copy of this
                                 software and associated documentation files (the “Software”), to deal in the Software without
                                 restriction, including without limitation the rights to use, copy, modify, merge, publish,
                                 distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
   136   137   138   139   140   141   142   143   144   145   146