Hi all,
Just after a quick bit of help, I'm trying to get the SPI interface on a 16F873A to work, without much luck... if you could have a look at the code below and let me know where I've gone wrong that would be good
I've got the micro linked up to a shift register, which in turn is linked to 8 LED's. The enable and strobe pins of the shift register are linked to porta of the micro, and data to SDO, clock to SCK. When i put a probe across enable and strobe, they pulse as they should, but i get no output from SCK and SDO.
Cheers
Sam J
Just after a quick bit of help, I'm trying to get the SPI interface on a 16F873A to work, without much luck... if you could have a look at the code below and let me know where I've gone wrong that would be good
I've got the micro linked up to a shift register, which in turn is linked to 8 LED's. The enable and strobe pins of the shift register are linked to porta of the micro, and data to SDO, clock to SCK. When i put a probe across enable and strobe, they pulse as they should, but i get no output from SCK and SDO.
Code:
movlw B'00100000' ;set port A bits according to their function, ;1=input, 0=output
movwf trisa
movlw B'10010000'
movwf trisc ;and port C bits
;set up SPI
movlw B'00110001'
movwf SSPCON
movlw B'00000000'
movwf SSPSTAT
movlw 00
clrf porta
clrf portb
clrf portc
loop bsf porta,sipo_strobe
bcf porta,sipo_enable
call delay200
movlw B'10101010'
movwf sspbuf
call delay200
bcf porta,sipo_strobe
bsf porta,sipo_enable
call delay1000
bsf porta,sipo_strobe
bcf porta,sipo_enable
call delay200
movlw B'01010101'
movwf sspbuf
call delay200
bcf porta,sipo_strobe
bsf porta,sipo_enable
call delay1000
goto loop
Cheers
Sam J