hallo ich brauche hilfe für das senden und empfangen für spi. vielleicht kann einer mal unten die erläuterungen durchlesen. ich progge mit fasavr-basic. der empfang des werte funktioniert nicht. meine englischkenntnisse sind bescheiden. text für den slave : Description: Receives a value from the SPI-bus in SLAVE mode. Syntax: var = SpiIn var variable to receive data from the SPI bus Remarks: SS pin is input and must be driven by MASTER! Example: n=SpiIn Description: Sends the value of a variable to the SPI-bus in MASTER mode. text für den master : Syntax: SpiOut var SpiOut var1; var2;....,wait SpiOut var1, n, wait var, var1, var2 variables to be shifted out n number of bytes from SRAM to send via SPI bus, starting with var1 Remarks: SS pin is set to OutPut (user can use this pin to select SLAVE)! Example: SpiOut i 'ShiftOut i (9) die inition der spi-schnittstelle : Description: Defines the SPI bus parameters. Syntax: $Spi num, Lsb|Msb, Master|Slave, Hi|Low, Hi|Low Remarks: num is the Clock division number for setting speed: 4, 16, 64, 128 Lsb or Msb tells which bit will be shifted out first. First Hi or Low for Clock polarity (see Atmel's data) Second Hi or Low for Clock Phase (see Atmel's data) Note: During SPI initialization as Master Clk and MOSI are set to be output. SS must be held high! Example: $Spi 128, Lsb, Master, Hi, Low ich kann die werte für hi undlow bzw lsb und msb usw nicht einordnen ($Spi num, Lsb|Msb, Master|Slave, Hi|Low, Hi|Low) . die leitungen habe ich an mosi,miso,ss, sck und die beiden atmega noch mit masse verbunden. programm läüft nicht. mein code master : $Device= m8 $Stack = 32 $Clock = 8 $Baud = 19200 $Spi 64, Lsb, Master, Hi, Low Enable Ovf0 Enable Interrupts WaitMs 255 Do WaitMs 250 SpiOut 23 Loop End mein code slave : $Device= m32 $Stack = 32 $Clock = 8 $Baud = 19200 $Spi 64, Lsb,Slave, Hi, Low $Lcd = PORTC.0, RS=PORTC.5, EN=PORTC.4, 16, 2 Dim a As Byte Enable Ovf0 Enable Interrupts WaitMs 255 Do WaitMs 250 a=SpiIn Cls Lcd a Loop End danke. mfg
hallo, dieses kommt in die empfangsroutine vom atmega32 , der interrupt . läuft aber nicht! Do WaitMs 250 Cls Lcd a Loop Interrupt Spi(), Save 2 Disable Spi Enable Interrupts a=SpiIn Enable Spi End Interrupt
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.