'#=========================================================================== '# 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 'RS232 (UART) '--------------------- '$baud = 300 'Baud 3,33 ms '$baud = 2400 'Baud 417 µs '$baud = 4800 'Baud 214 µs $baud = 9600 'Baud 104 µs '$baud = 19200 '$baud = 38400 'Baud 26 µs '=================================================================================== 'Programm Config '=================================================================================== '=================================================================================== 'Declarations Subs/Functions '=================================================================================== '=================================================================================== 'CONTROLLER PIN SETTINGS AND GLOBAL VARS '=================================================================================== Dim tmpByte as Byte Const CMD_BUFFER_CNT = 10 ' Count of max command bytes Dim _cmd_buffer(CMD_BUFFER_CNT) as byte ' buffer cmds '================================================================= ' Programm '================================================================= Print "Starting CU-R-CONTROL RS232.." Do 'MAINLOOP If Ischarwaiting() <> 0 Then 'Empfangen For tmpByte = 1 To CMD_BUFFER_CNT _cmd_buffer(tmpByte) = InKey() Waitms 10 Next tmpByte 'Senden For tmpByte = 1 To CMD_BUFFER_CNT Print "I'am undestanding : " ; _cmd_buffer(tmpByte) ; " as Byte :" ; tmpByte 'Reset Buffer _cmd_buffer(tmpByte) = 0 waitms 10 Next tmpByte Else Print "Waiting for Datas" Wait 1 End If Loop 'END MAINLOOP End 'END PROGRAM '=================================================================================== 'FUNCTIONS/SUBS '===================================================================================
News Blog:
Gerade online:4 - Heute insgesamt:599