Bascom PWM geht nicht

Gast #3446863
Lesenswert?

Hat jemand eine Idee,

die LED will uns verrecken nicht seine Helligkeit ändern;-(((

Bin verzweifelt;-)


An PB3 (PIN 17) hängt eine LED mit der Kathode, über 220 Ohm geht's an 
Plus.

Fusebits sind auf internen Oszi eingestellt.





'PWM with output on the PB3(OC1) pin.


$regfile = "m88def.dat"
$crystal = 8000000
$hwstack=40
$swstack=16
$framesize=32


$crystal = 8000000

Config Portb.1 = Output
Config Portb.2 = Output

Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Prescale = 
1


Config Pinb.4 = Input


Enable Interrupts

Compare1a = 1023

Waitms 1000

Compare1a = 0

Waitms 1000

Do

'If Pinb.4 = 0 Then

'Capture1 = Capture1 + 10

'End If

'Compare1a = Capture1

Incr Compare1a

Waitms 10

Loop

End

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren