Irgendwie funzt es nicht..ich poste mal was schon fertig ist
'***********************************************************************
********
' Schalter an PD.1 High = "Fader" Low = "Fix"
' 10k-Poti an PC.0
' LED Rot an PB.1
' LED Grün an PB.2
' LED Blau an PB.3
'***********************************************************************
********
$sim
$regfile = "m8def.dat"
$crystal = 16000000
$hwstack = 32
$swstack = 10
$framesize = 40
Config Portb.1 = Output 'LED Rot
Config Portb.2 = Output 'LED Gruen
Config Portb.3 = Output 'LED Blau
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Compare B Pwm
= Clear Up , Prescale = 1
Config Timer2 = Pwm , Pwm = On , Compare Pwm = Clear Down , Prescale = 1
Enable Timer1
Enable Timer2
Start Timer1
Start Timer2
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
Dim Pause As Byte
Dim Speed As Byte
Dim Rwert As Integer
Dim Adc0 As Integer
R Alias Compare1a
G Alias Compare1b
B Alias Ocr2
Config Pind.1 = Input
Portd.1 = 1
Taster1 Alias Pind.1
Config Lcdpin = Pin , Db7 = Portb.5 , Db6 = Portc.1 , Db5 = Portc.2 ,
_
Db4 = Portc.3 , E = Portc.4 , Rs = Portc.5
Config Lcd = 16 * 2
Cls
Cursor Off
Do
Pause = 2
Speed = 1
If Taster1 = 0 Then
Do
Incr G
Waitms Speed
Loop Until G = 255
Waitms Pause
Do
Decr R
Waitms Speed
Loop Until R = 0
Waitms Pause
Do
Incr B
Waitms Speed
Loop Until B = 255
Waitms Pause
Do
Decr G
Waitms Speed
Loop Until G = 0
Waitms Pause
Do
Incr R
Waitms Speed
Loop Until R = 255
Waitms Pause
Do
Decr B
Waitms Speed
Loop Until B = 0
Waitms Pause
End If
If Taster1 = 1 Then
Adc0 = Getadc(0)
Rwert = Adc0 / 4
Locate 1 , 1
Lcd Adc0
Locate 2 , 1
Lcd Rwert
R = Rwert
G = 0
B = 0
End If
Loop