candy66
Newbie level 6
hello i am working on pic18f452.I wrote a program to receive data from com and light up led when recieved data, but it failed to function.This is my program...can any one help?
list P=PIC18F452, F=INHX32, C=160, N=0, ST=OFF, MM=OFF, R=DEC, X=ON
#include "P18F452.inc"
__CONFIG _CONFIG1H, _HS_OSC_1H
variables UDATA
trisc res 1
status res 1
rcsta res 1
rcreg res 1
recieve res 1
org 0x00
clrf PORTB ; clear PORTB output latch
movlw 00H ; Set all pins PORTB as output
movwf TRISB
movlw 0x08
movwf TRISC
movlw 0x19
movwf SPBRG
movlw b'00100100'
movwf TXSTA
bsf RCSTA,SPEN
loop call receive ; wait for a char
call ON
goto loop
receive btfss PIR1,RCIF ; (5) check for received data
goto receive
movf RCREG; save received data in W
ON
btfss PIR1,RCIF
goto ON
movlw 08H ; move it from register 1 to w.
movwf LATB ; move it to PORTB to light up the
return
end
list P=PIC18F452, F=INHX32, C=160, N=0, ST=OFF, MM=OFF, R=DEC, X=ON
#include "P18F452.inc"
__CONFIG _CONFIG1H, _HS_OSC_1H
variables UDATA
trisc res 1
status res 1
rcsta res 1
rcreg res 1
recieve res 1
org 0x00
clrf PORTB ; clear PORTB output latch
movlw 00H ; Set all pins PORTB as output
movwf TRISB
movlw 0x08
movwf TRISC
movlw 0x19
movwf SPBRG
movlw b'00100100'
movwf TXSTA
bsf RCSTA,SPEN
loop call receive ; wait for a char
call ON
goto loop
receive btfss PIR1,RCIF ; (5) check for received data
goto receive
movf RCREG; save received data in W
ON
btfss PIR1,RCIF
goto ON
movlw 08H ; move it from register 1 to w.
movwf LATB ; move it to PORTB to light up the
return
end