Ich hätte dir jetzt beinahe den AT89C51ED2 von Atmel empfohlen abr der
hat nur 4 PWM Ausgänge.
So wie es aussieht must Du es Softwaremässig realisieren.
Ich hab mal sowas versucht, siehe folgendes Programm, um ein Lauflicht
mit 8 LEDs zu dimmen.
Einfach mal Ausprobieren. Läuft auf AT89C51ED2 aber es sollte auch auf
jeden anderen 8051er lauffähig sein.
Man benötigt allerdings ProgStudio 2007 von Batronix, hier kannst Du ne
Demo bis 2k herunterladen:
http://www.progshop.com/versand/software/prog-studio/index.html
flags EQU 20h
fl BIT flags.0
fl1 BIT flags.1
fl2 BIT flags.2
fl3 BIT flags.3
fl4 BIT flags.4
fl5 BIT flags.5
fl6 BIT flags.6
fl7 BIT flags.7
duty DATA 30h
duty1 DATA 31h
duty2 DATA 32h
duty3 DATA 33h
duty4 DATA 34h
duty5 DATA 35h
duty6 DATA 36h
duty7 DATA 37h
MAX EQU 255
MIN EQU 0
tick EQU R0
$INCLUDE "D:\Batronix\Prog-Studio 2007
Community\Microcontroller\Atmel\89c51ed2.mc"
LJMP start
ORG 000Bh ;Interrupt Timer 0
LJMP ISR_Timer0
start:
MOV flags,#00
MOV duty,#100
MOV duty1,#80
MOV duty2,#60
MOV duty3,#40
MOV duty4,#30
MOV duty5,#20
MOV duty6,#10
MOV duty7,#00
MOV P1,#00
MOV TMOD,#00000010b ;Timer 0 Initialisieren
MOV TH0,#0A0h
MOV TL0,#0A0h
SETB EA
SETB ET0
SETB TR0
xxx:
SJMP xxx
ISR_Timer0:
PUSH PSW
CLR TF0
INC tick
CLR c
MOV A,tick
CJNE A,#45,ISRX
MOV tick,#0
SJMP ISRNEXT
ISRX:
LJMP ISRXXX
ISRNEXT:
If Not BIT fl Then INC duty Else DEC duty
If Not BIT fl1 Then INC duty1 Else DEC duty1
If Not BIT fl2 Then INC duty2 Else DEC duty2
If Not BIT fl3 Then INC duty3 Else DEC duty3
If Not BIT fl4 Then INC duty4 Else DEC duty4
If Not BIT fl5 Then INC duty5 Else DEC duty5
If Not BIT fl6 Then INC duty6 Else DEC duty6
If Not BIT fl7 Then INC duty7 Else DEC duty7
If duty = MAX Then SETB fl
If duty = #MIN Then CLR fl
If duty1 = MAX Then SETB fl1
If duty1 = #MIN Then CLR fl1
If duty2 = MAX Then SETB fl2
If duty2 = #MIN Then CLR fl2
If duty3 = MAX Then SETB fl3
If duty3 = #MIN Then CLR fl3
If duty4 = MAX Then SETB fl4
If duty4 = #MIN Then CLR fl4
If duty5 = MAX Then SETB fl5
If duty5 = #MIN Then CLR fl5
If duty6 = MAX Then SETB fl6
If duty6 = #MIN Then CLR fl6
If duty7 = MAX Then SETB fl7
If duty7 = #MIN Then CLR fl7
ISRXXX:
If tick < duty Then CLR P1.0 Else SETB P1.0
If tick < duty1 Then CLR P1.1 Else SETB P1.1
If tick < duty2 Then CLR P1.2 Else SETB P1.2
If tick < duty3 Then CLR P1.3 Else SETB P1.3
If tick < duty4 Then CLR P1.4 Else SETB P1.4
If tick < duty5 Then CLR P1.5 Else SETB P1.5
If tick < duty6 Then CLR P1.6 Else SETB P1.6
If tick < duty7 Then CLR P1.7 Else SETB P1.7
POP PSW
RETI