Gast
#440194
Hallo,
Ich möchte eine PWM mit einem 10k Poti eisntellen.
Gefundenund getestet habe ich dieses Programm hier:
$regfile = "m16def.dat"
$framesize = 32
$swstack = 32
$hwstack = 32
$crystal = 8000000
Config Porta.1 = Input
Config Pind.5 = Output '
Porta = &B00000010
Dim Analogwert As Word
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Prescale = 1
Config Adc = Single , Prescaler = Auto , Reference = Internal
Start Adc
Do
Analogwert = Getadc(1)
Analogwert = Analogwert / 2
If Analogwert > 255 Then Analogwert = 255
Pwm1a = Analogwert
Loop
End
Funktioniert auch, allerdings bekomme ich die PWM nicht ganz aus (Also
PWM ist immer etwas größer null) und auch die max. Geschw. wird nciht
erreicht.
Kann mir vielleicht jemand helfen warum es nicht klappt?
Wieso muss der Analogwert durhc vier geteilt werden?
Gruss
Alex