'#=========================================================================== '# UU UU LL RRRRR II CCCCC HH HH CCCCCCC (c) 2008 '# UU UU LL RR RR II CC HH HH CCC '# UU UU LL RRRRR II CC HHHHHH CC Christian Ulrich (UlrichC) '# UU UU LL RR RR II CC HH HH CC URL:http://www.UlrichC.de '# UU UU LL RR RR II CC HH HH CCC '# UUU LLLLLL RR RR II CCCCC HH HH CCCCCCC eMail:Info@UlrichC.de '#=========================================================================== '# CU-TEMPLATE (MC-Source) alias cu-template(someone).bas Version 0.01 '#--------------------------------------------------------------------------- '# COPYRIGHTS '# This source code of http://www.ulrichc.de/ is licensed under the GNU/GPL '# '# You can redistribute it and/or modify it under the terms of the '# GNU General Public License as published by the Free Software Foundation; '# either version 2 of the License, or (at your option) any later version. '# See http://www.gnu.org/ '# '# Author:Christian Ulrich,(Germany)76448 Durmersheim Lk Rastatt,06.05.2008 '#--------------------------------------------------------------------------- '#--------------------------------------------------------------------------- '# NOTE '#--------------------------------------------------------------------------- '# Dieses Programm beschreibt ... '# Die Source basiert auf BASCOM Basic. '#--------------------------------------------------------------------------- '# This program describes ... '# The source is based on BASCOM Basic. '#--------------------------------------------------------------------------- '=================================================================================== 'CONTROLLER HW SETTINGS '=================================================================================== '$regfile = "m8def.dat" 'AVR Mega 8 '$regfile = "m16def.dat" 'AVR Mega 16 $regfile = "m32def.dat" 'AVR Mega 32 '$framesize = 32 'Stack '$framesize = 68 '$framesize = 82 $framesize = 128 '$swstack = 32 'Software Stack '$swstack = 68 '$swstack = 82 $swstack = 128 '$hwstack = 32 'Hardware Stack '$hwstack = 62 '$hwstack = 82 $hwstack = 128 'CRYSTAL '--------------------- '$crystal = 1000000 'Quarzfrequence 1 Mhz (internal crystal) '$crystal = 4000000 'Quarzfrequence 4 Mhz $crystal = 8000000 'Quarzfrequence 8 Mhz '$crystal = 14318180 'Quarzfrequence 14.31818 Mhz '$crystal = 16000000 'Quarzfrequence 16 Mhz '=================================================================================== 'Programm Config '=================================================================================== Const DEFAULT_SERVO_RANGE = 200 'default range of servo '=================================================================================== 'Declarations Subs/Functions '=================================================================================== '=================================================================================== 'CONTROLLER PIN SETTINGS AND GLOBAL VARS '=================================================================================== Dim I As Byte I = 0 Config PinB.2 = Output Config PinB.3 = Output Config Servos = 2 , Servo1 = PORTB.2 , Servo2 = PORTB.3 , Reload = 10 'auto config Enable Interrupts '================================================================= ' Programm '================================================================= Servo(1) = DEFAULT_SERVO_RANGE / 2 'set middel pos Servo(2) = DEFAULT_SERVO_RANGE / 2 'set middel pos wait 1 Do 'MAINLOOP Do Servo(1) = I Servo(2) = DEFAULT_SERVO_RANGE - I Waitms 10 I = I + 5 Loop Until I > DEFAULT_SERVO_RANGE Wait 1 Do Servo(1) = I Servo(2) = DEFAULT_SERVO_RANGE - I Waitms 10 I = I - 5 Loop Until I < 1 Loop 'END MAINLOOP End 'END PROGRAM '=================================================================================== 'FUNCTIONS/SUBS '===================================================================================
News Blog:
Gerade online:1 - Heute insgesamt:297