Robie projekt ktory sklada sie z jednego mastera i paru slavow.
Problem: nie bardzo dziala mi odbieranie danych po spi. Dodam, ze odbieranie mialo byc po przerwaniu od spi.
Gdy mam spiin w petli jest wszystko ok, jak odbieram w przerwaniu to odbiera co 2 byte. Na lcd pojawia sie 0 , 2 , 4 a powinno 0,1,2,3,4 itd.
Master:
slave
Jakis pomysl?
Problem: nie bardzo dziala mi odbieranie danych po spi. Dodam, ze odbieranie mialo byc po przerwaniu od spi.
Gdy mam spiin w petli jest wszystko ok, jak odbieram w przerwaniu to odbiera co 2 byte. Na lcd pojawia sie 0 , 2 , 4 a powinno 0,1,2,3,4 itd.
Master:
$regfile = "m8def.dat"
$crystal = 8000000
Config Spi = Hard , Data Order = Msb , Master = Yes , Interrupt = Off , Polarity = High , Phase = 0 , Clockrate = 4 , Noss = 1
$swstack = 40
$hwstack = 40
$framesize = 40
Dim V As Byte
V = 0
Spiinit
Do
Spiout V , 1
Wait 1
Incr V
Loop
End
slave
$regfile = "m32def.dat"
$crystal = 8000000
$swstack = 100
$hwstack = 100
$framesize = 100
Config Lcd = 24 * 2
Config Spi = Hard , Data Order = Msb , Master = No , Interrupt = On , Polarity = High , Phase = 0 , Clockrate = 4 , Noss = 0
Config Lcdpin = Pin , Rs = Porta.0 , E = Porta.1 , Db4 = Porta.2 , Db5 = Porta.3 , Db6 = Porta.4 , Db7 = Porta.5
Dim V As Byte
On Spi Odbieranie
Enable Interrupts
Spiinit
Cls
Do
Locate 1 , 1
Lcd V
Loop
End
Odbieranie:
Spiin V , 1
Return
Jakis pomysl?