Interessant.
Pass es dir an und probier mal das Programm hier.
Code:
$regfile = "m16def.dat"
$crystal = 16000000
$baud = 1200
Dim A As Word
Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down , Prescale = 8
Config Pind.5 = Output
Config Pind.4 = Output
Do
Gosub Testa
Waitms 3000
Gosub Testb
Loop
Testa:
Pwm1a = 100
Waitms 100
Pwm1a = 200
Waitms 100
Pwm1a = 400
Waitms 100
Pwm1a = 700
Waitms 100
Pwm1a = 1023
Waitms 100
Pwm1a = 700
Waitms 100
Pwm1a = 400
Waitms 100
Pwm1a = 200
Waitms 100
Pwm1a = 100
Waitms 100
Pwm1a = 0
Waitms 1000
Pwm1b = 100
Waitms 100
Pwm1b = 200
Waitms 100
Pwm1b = 400
Waitms 100
Pwm1b = 700
Waitms 100
Pwm1b = 1023
Waitms 100
Pwm1b = 700
Waitms 100
Pwm1b = 400
Waitms 100
Pwm1b = 200
Waitms 100
Pwm1b = 100
Waitms 100
Pwm1b = 0
Waitms 1000
Return
Testb:
For A = 1 To 1023 Step 1
Pwm1a = A
Pwm1b = A
Waitms 20
Next A
Return
End
Mit direktem Wert geht es aber über ne Variable will er nicht.
Wenn ich PWM = 8 nehme und Byte für A dann gehts.
Scheint nen neuer Bug zu sein denn früher gabs die Macke nicht.
Da ist also aufspitten des Wertes und direktes einschreiben in die Register angesagt oder du begnügst dich mit 8 Bit.
Lesezeichen