rohan0630056
Newbie level 4
- Joined
- Jun 17, 2009
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Bangladesh
- Activity points
- 1,335
pic16f877a usart tutorial
I am trying to receive a number send from PC to the PIC16F877A. I learned to program on MPLAB... I can transmit data from PC to PIC but cant receive,, can any1 PLZ help me on this purpose. PLZ Help me...i cant find y the code is not working...can u plz tell me...
My code is given below:
list p=16f877
include <p16f877.inc>
org 0x00
goto start
start
bsf INTCON, GIE
bsf INTCON, PEIE
call initialPORTS
call initialSPAC
return
initialPORTS
bsf STATUS, RP0
movlw b'00000000'
movwf TRISB
movlw b'11000000'
movwf TRISC
bcf STATUS, RP0
clrf PORTB
clrf PORTC
return
initialSPAC
bsf STATUS, RP0
movlw b'00100100'
movwf TXSTA
movlw .25
movwf SPBRG
bcf STATUS, RP0
movlw b'10010000'
movwf RCSTA
loop
btfsc PIR1, 3
call initialREC
goto loop
return
initialREC
movf RCREG,0
movwf PORTB
return
end
I am trying to receive a number send from PC to the PIC16F877A. I learned to program on MPLAB... I can transmit data from PC to PIC but cant receive,, can any1 PLZ help me on this purpose. PLZ Help me...i cant find y the code is not working...can u plz tell me...
My code is given below:
list p=16f877
include <p16f877.inc>
org 0x00
goto start
start
bsf INTCON, GIE
bsf INTCON, PEIE
call initialPORTS
call initialSPAC
return
initialPORTS
bsf STATUS, RP0
movlw b'00000000'
movwf TRISB
movlw b'11000000'
movwf TRISC
bcf STATUS, RP0
clrf PORTB
clrf PORTC
return
initialSPAC
bsf STATUS, RP0
movlw b'00100100'
movwf TXSTA
movlw .25
movwf SPBRG
bcf STATUS, RP0
movlw b'10010000'
movwf RCSTA
loop
btfsc PIR1, 3
call initialREC
goto loop
return
initialREC
movf RCREG,0
movwf PORTB
return
end