Lieber Besucher, herzlich willkommen bei: Das Wettringer Modellbauforum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.
Danach habe ich mal noch folgende den Port für die Led geändert und danach das Programm mal gebrannt mit dem mySmartUSB. Und diesmal war keine Fehlermeldung gekommen und nachdem ich dasZitat
'Definition für Mega 8
$regfile "m8def.dat"
und neu schaut es so aus.
'Definition für Mega 8A
$regfile "m8Adef.dat"
Achja ich weiß viele werden sich jetzt nicht viel unter diesem Code vorstellen können. Da habe ich noch ein kleines Video für euch gemacht, dort sieht man dann mal den Efekt den ich Programmiert habe.Zitat
'Blitzer Steuerung für Modellautos'
'Prozessor: ATMega 8A
$regfile "m8adef.dat"
$crystal = 1000000
'Definiton der LED´s
Config Portb.0 = Output
Config Portb.1 = Output
Dim Speed As Integer
Speed = 250
Do
Portb.0 = 1
Waitms Speed
Portb.0 = 0
Waitms Speed
Portb.0 = 1
Waitms Speed
Portb.0 = 0
Waitms 500
Portb.1 = 1
Waitms Speed
Portb.1 = 0
Waitms Speed
Portb.1 = 1
Waitms Speed
Portb.1 = 0
Waitms 500
Loop
End
weißt du was ich da Falsch gemacht habe???Zitat
$crystal = 8000000
'Definiton der LED´s
Config Portb.0 = Output
Config Portb.1 = Output
Const Off = 1
Const On = 0
Const Led_green Portb.0 < hier gibt er mir eine Fehlermeldung expected in filename
Const Led_red Portb.1 < hier gibt er mir eine Fehlermeldung expected in filename
Dim Speed As Integer
Speed = 250
Do
Led_1 On
Waitms Speed
Led_1 Off
Waitms Speed
Led_1 On
Waitms Speed
Led_1 Off
Waitms 500
Led_2 On
Waitms Speed
Led_2 Off
Waitms Speed
Led_2 On
Waitms Speed
Led_2 Off
Waitms 500
Loop
End
Habe mal die Zeile Rot gefärbt wo die Fehlermeldung kommt.Zitat
'Blitzer Steuerung für Modellautos'
'Prozessor: ATMega 8A
$regfile "m8adef.dat"
$crystal = 8000000
'Definiton der LED´s
Const On = 1
Const Off = 0
Config Portb.0 = Output
Config Portb.1 = Output
Config Portc.0 = Output
Config Portc.1 = Output
Config Portc.2 = Output
Config Portc.3 = Output
Declare Sub Rundumlicht
Dim Speed As Integer
Speed = 100
Do
Portc.0 = On
Waitms Speed
Portc.0 = Off
Portc.1 = On
Waitms Speed
Portc.1 = Off
Portc.2 = On
Waitms Speed
Portc.2 = Off
Portc.3 = On
Waitms Speed
Portc.3 = Off
Loop
End Sub Rundumlicht <- Hier kommt die Fehlermeldung
Dim Speed As Integer
Speed = 20
Do
Call Sub Rundumlicht
Portb.0 = On
Portb.1 = On
Waitms Speed
Portb.0 = Off
Portb.1 = Off
Waitms Speed
Portb.0 = On
Portb.1 = On
Waitms Speed
Portb.0 = Off
Portb.1 = Off
Waitms 150
Loop
End
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
'Blitzer Steuerung für Modellautos' 'Prozessor: ATMega 8A $regfile "m8def.dat" $crystal = 8000000 'Definiton der LED´s Const On = 1 Const Off = 0 Config Portb.0 = Output Config Portb.1 = Output Config Portc.0 = Output Config Portc.1 = Output Config Portc.2 = Output Config Portc.3 = Output Dim Speed As Integer '------------------------------------------------------------------------------ Speed = 20 Do Gosub Rundumlicht Portb.0 = On Portb.1 = On Waitms Speed Portb.0 = Off Portb.1 = Off Waitms Speed Portb.0 = On Portb.1 = On Waitms Speed Portb.0 = Off Portb.1 = Off Waitms 150 Loop End '------------------------------------------------------------------------------ Rundumlicht: Speed = 100 Portc.0 = On Waitms Speed Portc.0 = Off Portc.1 = On Waitms Speed Portc.1 = Off Portc.2 = On Waitms Speed Portc.2 = Off Portc.3 = On Waitms Speed Portc.3 = Off Return '------------------------------------------------------------------------------ |
Werde das ganze dann nochmal mit meinen Potis testen die ich bisher für die Rundumlichtschaltung genommen habe. Damit ich die Bestmögliche Taktgeschwindigkeit finde. Dann wird es auch für euch ein Video davon geben.Zitat
' Geändert am 14.01.2013 für Atmega8A durch Patrick Niklas
'
' In: D.2: Poti-Mittelabgriff
' oder LDR-Spannungsteiler an ADC1
' Out: LED B.0
' LED B.1
' LED B.4
' LED B.5
'
$regfile = "m8adef.dat"
$crystal = 2000000
Config Portd.2 = Input 'Poti/LDR
Config Portb.0 = Output 'LED 1
Config Portb.1 = Output 'LED 2
Config Portb.4 = Output 'LED 3
Config Portb.5 = Output 'LED 4
Led_1 Alias Portb.0
Led_2 Alias Portb.1
Led_3 Alias Portb.4
Led_4 Alias Portb.5
Dim Analogwandler As Integer 'Variable zur Aufnahme des Wertes vom Analogwandler
Config Adc = Single , Prescaler = Auto , Reference = Avcc 'Analogwandler definieren
'Start Adc 'AD-Wandler starten (nach Config automatisch)
Do
Analogwandler = Getadc(1) 'AD-Wandler einlesen. Werte zwischen 0 und 1023
Led_1 = 1
Led_2 = 0
Led_3 = 0
Led_4 = 0
Waitms Analogwandler
Led_1 = 0
Led_2 = 1
Led_3 = 0
Led_4 = 0
Waitms Analogwandler
Led_1 = 0
Led_2 = 0
Led_3 = 1
Led_4 = 0
Waitms Analogwandler
Led_1 = 0
Led_2 = 0
Led_3 = 0
Led_4 = 1
Waitms Analogwandler
Loop
End
Zitat
Quelle: hier zu finden
Beschreibung
SMD LED Bauart 1206
300 mcd sehr hell
0,35/0,35 gleichmäßiger
Verlauf
Länge 3,2 mm
Breite 1,6 mm
Höhe 1,1 mm
V typ. 3,2 V
V max. 3,6 V
Die Linse ist Yellow-diffused
RoHS konform
Forensoftware: Burning Board®, entwickelt von WoltLab® GmbH