Zitat Zitat von Grave
Ich brauch das nicht für TV. Ich muß so ca. 40 LED´s ein und ausschalten. Ich wollte zwei IC´s hintereinnander schalten

Würde mal gerne deinen Code sehen.
oder du änderst die routine im empfand so das das 2te zeichen innerhal einer kurzen zeit nach kommt, sonst wird das erste zeichen ausgeführt...
Genau das. Aber wie???

brauchst du wirklich 2 IC ? 40 sind
6x7 oder 5x8 Ports bleiben in Summe 13 nötige Portpins, die als Kreuzungsmatrix einer aus 5 High Zeilen, einer aus 8 low Spalten, schaltet genau eine LED on, kann man natürlich mit 2x 8Bit I2C zu parallel machen



grün funzt , getestet
rot ungetestet, sollte klappen


$regfile = "2313def.dat" ' specify the used micro
$crystal = 4000000 ' used crystal frequency
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space

Ddrb = &H1F
Ddrd = 251

Config Rc5 = Pind.2 'RC5_input
Portd.0 = 0 'toogle Bit Led Aus
Portb.0 = 1 'Cam Auslöseport high

Enable Interrupts
Declare Sub Dimm_pwm

Dim Address As Byte , Command As Byte , Oldaddress As Byte ,
Oldtoggle As Byte, Oldcommand As Byte
Dim Led_hell As Byte
Dim A As Byte , Count As Long
Dim Strcount As String * 12

Led_hell = 250

Oldaddress = 0
Oldcommand = 0

Oldtoggle=0

'define the used constants
'I used portA for testing
'Const _lcdport = Portb
'Const _lcdddr = Ddrb
'Const _lcdin = Pinb
'Const _lcd_e = 1
'Const _lcd_rw = 2
'Const _lcd_rs = 3

'this is like always, define the kind of LCD
Config Lcd = 20 * 4 'other options are 16 * 2 , 16 * 4 and 20 * 4, 20 * 2 , 16 * 1a
Config Lcdpin = Pin , Db7 = Portd.6 , Db6 = Portd.5 , Db5 = Portd.4 , Db4 = Portb.4 , E = Portb.2 , Rs = Portb.1
Rem with the config lcdpin statement you can override the compiler settings
'[COMPILER-LCD]
'DB7=PORTB.7
'DB6=PORTB.6
'DB5=PORTB.5
'DB4=PORTB.4
'E=PORTB.2
'RS=PORTB.1

Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Down , Prescale = 8

'and here some simple lcd code
Cursor Off Noblink
Cls
Locate 1 , 1 : Lcd "35tes " 'display this at the top line
Count = 0
Compare1a = Led_hell

'Call Dimm_pwm

Do
Getrc5(address , Command)
If Address < 255 Then
If Command.7 = 1 Then



if Command.7<> Oldtoggle then
Oldtoggle=Command.7
'hier kommt 1ter Tastendruck mit Adress Command kann was gemacht werden
else
'hier kommt 2ter Tastendruck mit Adress Command kann was anderes gemacht werden
endif



Portd.0 = 1 : Command.7 = 0

Else
Portd = 0
End If
If Count <= 1000 Then
Count = Count + 1
Strcount = Str(count)
Else
Strcount = ">1000"
End If
A = 20 - Len(strcount)
Locate 1 , 15
Lcd " "
Locate 1 , A
Lcd Strcount

Locate 3 , 1 : Lcd "Address=" ;
Locate 4 , 1 : Lcd "Command=" ;

If Address = 7 And Command = 6 And Led_hell < 245 Then Led_hell = Led_hell + 10
If Address = 7 And Command = 12 And Led_hell > 10 Then Led_hell = Led_hell - 10
Compare1a = Led_hell
Locate 1 , 10 : Lcd " "
Locate 1 , 10 : Lcd Led_hell
Locate 3 , 9 : Lcd Address
Locate 4 , 9 : Lcd Command
If Command <> Oldcommand Or Address <> Oldaddress Then
Oldcommand = Command
Oldaddress = Address
Locate 2 , 1 : Lcd " "
Locate 2 , 1 : Lcd "Old..."
Locate 2 , 7 : Lcd Oldaddress ; " ..."
Locate 2 , 11 : Lcd Oldcommand ; " ..."
Locate 2 , 15 : Lcd "Wait"
Count = 0
End If

If Address = 7 And Command = 54 Then
Toggle Portb.0
Waitms 500
Toggle Portb.0
End If

Else
Locate 3 , 9 : Lcd " "
Locate 4 , 9 : Lcd " "
End If
Loop
End

Sub Dimm_pwm

Dim I As Byte , J As Byte

For I = 1 To 2
For J = 255 To 64 Step -10
Compare1a = J
Waitms 10
Next J
Wait 1
For J = 64 To 255 Step 10
Compare1a = J
Waitms 10
Next J
Wait 1
Next I


End Sub