Un ejemplo para manejar un digital pot MCP41050 con SPI.
Define LOADER_USED 1
define OSC 20
" include "modedefs.bas"
CS var PORTB.5 " Chip select pin
SCK var PORTB.6 " Clock pin
SI var PORTB.7 " Data in pin
comando var byte " comando
cursor var byte " posicion cursor
TRISB = 0 " todo salidas
ADCON1 = 7 " Set PORTA and PORTE to digital
Pause 100 " Wait for LCD to start up
comando=00010001
For cursor=0 to 255
CS = 0
Shiftout SI, SCK, 1, [comando, cursor]
cs=1
Pause 5000
next cursor
cursor=128
CS = 0
Shiftout SI, SCK, 1, [comando, cursor]
cs=1
End