$regfile "m32def.dat" $crystal = 8000000 Dim Ff As Byte Dim I As Byte Dim Null As Byte Dim Cmd0(6) As Byte Dim Cmd1(6) As Byte Dim X As Byte Ff = 255 Null = 0 Cmd0(1) = &H40 Cmd0(2) = &H00 Cmd0(3) = &H00 Cmd0(4) = &H00 Cmd0(5) = &H00 Cmd0(6) = &H95 Cmd1(1) = &H41 Cmd1(2) = &H00 Cmd1(3) = &H00 Cmd1(4) = &H00 Cmd1(5) = &H00 Cmd1(6) = &HFF Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 0 , Clockrate = 64 , Noss = 0 Config Portb.0 = Output Ss Alias Portb.0 Ss = 1 Spiinit Print "HALLO" Gosub Init Do Loop Init: Waitms 2 Do Spiout Ff , 1 Incr I Waitus 100 Loop Until I = 9 Waitms 2 Ss = 0 Spiout Cmd0(1) , 6 Waitus 100 X = Spimove(&Hff) Print X Ss = 1 Spiout Ff , 1 Waitms 2 Ss = 0 Waitus 100 Spiout Cmd1(1) , 6 Waitus 10 Spiout Ff , 1 Waitus 10 Spiout Ff , 1 X = Spimove(&Hff) Print X Waitms 1 X = Spimove(&Hff) Print X Waitms 1 X = Spimove(&Hff) Print X Waitms 1 X = Spimove(&Hff) Print X Waitms 10 X = Spimove(&Hff) Print X Waitms 10 X = Spimove(&Hff) Print X Waitms 10 X = Spimove(&Hff) Print X Waitms 10 X = Spimove(&Hff) Print X Waitms 100 X = Spimove(&Hff) Print X Waitms 100 X = Spimove(&Hff) Print X Waitms 100 X = Spimove(&Hff) Print X Waitms 200 X = Spimove(&Hff) Print X X = Spimove(&Hff) Print X Waitms 100 X = Spimove(&Hff) Print X Waitms 100 X = Spimove(&Hff) Print X Waitms 100 X = Spimove(&Hff) Print X Return