Try something like this:
[code:1:ba9dbdfb68]
'Your code
Ss Alias Portb.2
Config SS = Output 'SS
Set SS
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 1 , Clockrate = 4 , Noss = 1 'remove SPIIN = 255
Spiinit
'Your code
Do
Cls
Reset Ss
Spiout Wrt_adrs , 1
Spiout Address , 1
Spiin Readdata , 1 'You will need to modify this to read a 2 byte array; eg: SPIIN Readdata(1), 2 or DIM as Word
Set Ss
Lcd "Value = " ; Hex(readdata)
Locate 2 , 1 : Lcd I ; " Loops"
Wait 1
I = I + 1
Waitms 200
Loop
End[/code:1:ba9dbdfb68]
↧