ArtemisGoldfish
Member
Code:
BSF STATUS,RP0
MOVLW 0x06 ;All port A as digital
MOVWF ADCON1
MOVLW 0x00 ;All port A as output
MOVWF TRISA
MOVLW 0x25 ;SSPEN bit set, SPI Slave selected
MOVWF SSPCON
BCF TRISC,5 ;Setting PORTC in/out as required
BSF TRISC,3
BSF TRISC,4
BCF STATUS,RP0
loop: CALL cpy
BTFSC 0x20,0
COMF PORTA
GOTO loop
cpy: BSF STATUS,RP0
MOVF SSPSTAT,0
BCF STATUS,RP0
MOVWF 0x20
RETURN
END
Well, that's my filthy, awful code. There's an LED on a PORTA pin, so I just COMF the whole register whenever the BF flag is set. The only point to this program is just to see if it'll work with a serial interface like a PC, it waits around for a single character to be sent, and the LED turns on. Not as easy as it sounds, hahah.
Anyone have some experience with serial interfacing with this chip?