hi...i am using SKKCA-21 bluetooth module to as a connection between computer and
computer ---bluetooth dongle <---------------> uart---PIC16F877A
i followed the SKKCA-21 manual to test the funtionality and it is ok.....
i used the sample code of PR6A in my pic and it works.
i am using MPLab software for my project and i tried to convert the PR6A into pic assembly language. but it didn;t work at all and no connection is established.
here is my code. can anyone give me some guidance?
LIST p=16F877A
INCLUDE"P16F877a.inc"
__CONFIG _CP_OFF & _WDT_OFF & _HS_OSC & _PWRTE_ON
ans equ 0x25;
org 0x200
goto start
org 0x205
CLRF PORTB
start:
; UART module setup
banksel SPBRG;
movlw 10; ; baud as 115200
movwf SPBRG; ; Enable SPBRG register Baud Rate
banksel TXSTA; ; Select memory bank for TXSTA SFR
bcf TXSTA,TX9; ; 8-bit transmission
bsf TXSTA,TXEN; ; Enable Transmission
bcf TXSTA,SYNC; ; Asynchronous mode
bsf TXSTA,BRGH ; ; High Baud Rate
banksel RCSTA;
bsf RCSTA,SPEN; ; enable Serial port.
bsf RCSTA,CREN ; ; Enable Receiver
BANKSEL PIE1;
BCF PIE1,TXIE;
BCF STATUS, RP1;
BSF STATUS, RP0;
MOVLW 0X00 ; ; PORTB as output
MOVWF TRISB;
movlw b'11000000'; ; PORTC pin 6 and 7 as input
movwf TRISC;
BCF STATUS, RP0;
clrf PORTC;
loop1:
BTFSC PIR1, TXIF ; ; i wish to display an "ok" in hyperterminal
goto loop1;
movlw '0';
movwf TXREG;
loop2:
BTFSC PIR1, TXIF ;
goto loop2;
movlw 'k';
movwf TXREG;
loop:
btfsc PIR1, RCIF;
goto loop;
movf RCREG, W; ; if an input "9" is sent from computer, it will switch on a LED on PORTB pin 2
movwf ans;
movlw 0x09;
bcf STATUS, Z;
SUBWF ans,0;
btfss STATUS,Z;
goto loop;
movlw b'00000100';
movwf PORTB;
END