hallo, die programme unten laufen soweit !
bloss auf dem lcd wird immer nur jede 2. zahl angezeigt, je nachdem wo es anfängt zu zählen : 94,96,98.... oder 93,95,97.
woran liegt das?
master :
Code:
$regfile = "M8def.dat"
$crystal = 8000000
$hwstack = 32
$swstack = 32
$framesize = 64
$baud = 19200
Config Portb.5 = Output
Config Portb.4 = Input
Config Portb.3 = Output
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 0 , Clockrate = 64 , Noss = 1
Spiinit
Dim B As Byte
Waitms 255
Do
For B = 93 To 112
Spiout B , 1
Waitms 255
Next
Loop
End
slave :
Code:
$regfile = "M32def.dat"
$crystal = 8000000
$hwstack = 32
$swstack = 32
$framesize = 64
$baud = 19200
Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , E = Portc.4 , Rs = Portc.5
Config Lcd = 16 * 2
Config Spi = Hard , Interrupt = On , Data Order = Msb , Master = No , Polarity = High , Phase = 0 , Clockrate = 64 , Noss = 1
Spiinit
Enable Spi
On Spi Spi_isr
'Interrupt's global aktivieren
Enable Interrupts
Dim B As Byte , Status As Byte
Status = 0
Do
If Status = 1 Then
Cls
Lcd B
Waitms 50
Status = 0
End If
Loop
End
Spi_isr:
Spiin B , 1
Status = 1
Return
Lesezeichen