Naja ich poste jetzt mal einfach meinen Kram, das programm geht vollkommen. Vllt kannst du ja was finden was du vergessen hast (steh grad leider unter Zeitdruck und kann es daher nicht alles raussuchen).
Ist übrigens mein 1. Porgramm *fg*
Code:
$regfile = "m16def.dat"
$framesize = 32
$swstack = 32
$hwstack = 32
$crystal = 16000000
$baud = 9600
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , E = Portc.5 , Rs = Portc.4
Cls
Cursor Off
Dim U As Word
Dim I As Integer
Dim Teiler As Integer
Dim W As Integer
Teiler = 20 'Umrechnung A/D Wert
W = 1 'Abbruch Bedingung Eingabe
Config Adc = Single , Prescaler = Auto
Start Adc
Config Pina.0 = Input 'AD
Config Pinc.6 = Output 'LED
Config Pinc.7 = Input 'S1
Portc.7 = 1
'Start
Locate 1 , 1
Lcd "<<<<uC Timer>>>>"
Locate 2 , 1
Lcd "by Stefan Reible"
Wait 2
Cls
Locate 1 , 1
Do
Lcd "Loading"
Lcd " ."
Waitms 200
Lcd "."
Waitms 200
Lcd "."
Waitms 200
Incr I
Cls
Loop Until I = 3
'Eingabe Timer
I = 0
Do
Locate 1 , 1
Lcd "Timer setzen: "
U = Getadc(0)
I = U / Teiler
Locate 2 , 1
Lcd "Sek: " ; I ;
Locate 2 , 14
Lcd "OK?"
Waitms 200
Loop Until Pinc.7 = 0
'Go
Cls
U = I
I = 0
W = 0
Locate 1 , 1
Lcd "Timer = " ; U ; " Sek" ;
Locate 2 , 11
Lcd "Start?"
Wait 1
Do
If Pinc.7 = 0 Then
Do
Cls
Locate 1 , 1
Lcd U ; " Sekunden";
U = U - 1
Wait 1
Loop Until U = 0
W = 1
End If
Loop Until W = 1
Cls
Locate 1 , 1
Lcd "Fertig!"
Locate 2 , 1
Lcd "LED = AN"
Portc.6 = 1 'LED an
End 'end program
Mfg
Lenox
Lesezeichen