interfacing between computer and pic with SKKCA-21

Bluetooth, XBee, RF......

interfacing between computer and pic with SKKCA-21

Postby max_rasa » Wed Dec 29, 2010 11:30 am

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
max_rasa
Fledgling
 
Posts: 1
Joined: Wed Dec 29, 2010 11:02 am

Re: interfacing between computer and pic with SKKCA-21

Postby hyng » Wed Dec 29, 2010 1:30 pm

why should you use assembly language? isn't C programming is easier? :P
User avatar
hyng
Moderator
 
Posts: 292
Joined: Thu Apr 16, 2009 11:35 am

Re: interfacing between computer and pic with SKKCA-21

Postby robosang » Wed Dec 29, 2010 3:29 pm

Any code checker/debugger... please help this poor fellow :shock:
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: interfacing between computer and pic with SKKCA-21

Postby hyng » Wed Dec 29, 2010 5:04 pm

AFAIK, There is an option in MPLab --> View > Disassembly Listing which shows address, disassembly of hex code and also assembly code.
You can try check/debug your code from there.
User avatar
hyng
Moderator
 
Posts: 292
Joined: Thu Apr 16, 2009 11:35 am


Return to Wireless Device

Who is online

Users browsing this forum: No registered users and 13 guests