Hi everyone, I got an EGBC-04 bluetooth module. When I powered the EGBC-04 my pc detects it(Bluetooth discovery). But I'm having problem communicating with it(sending data only). I place leds to test the communication setup from PC to EGBC04 to PIC16F877A but no luck. Kindly check my setup and codes in the pic....I appreciate any help.
Thanks in advance,Code:CLEAR ;read and write hardware USART B1 VAR BYTE ;initialize USART TRISB = %00000000 PortB = %00000000 TRISC = %10111111 ;set TX (PORTC.6) to out, rest in SPBRG = 25 ;set baud rate to 2400 RCSTA = %10010000 ;enable serial port and continuous receive LOOP: GOSUB CHARIN ;get a character from serial input, if any IF B1 = 0 THEN LOOP ;no character yet GOTO LOOP ;do it forever ;subroutine to get a character ;from usart receiver CHARIN: B1 = 0 ;preset to no character received IF PIR1.5 = 1 THEN ;if receive flag then... B1 = RCREG ;get received character to b1 IF B1 = 65 then If PortB.0 = 0 then High PortB.0 else Low PortB.0 Endif ENdif ENdif goto loop
mbox
Bookmarks