View previous topic :: View next topic |
Author |
Message |
kazama
Joined: 01 Sep 2009 Posts: 10 Location: Malaysia
|
eb500 bluetooth module (Updated With USART Code...Need help) |
Posted: Thu Sep 03, 2009 4:00 pm |
|
|
hi guys, I'm currently making the bluetooth integration with my robot after finished my sensor problem. I'm using this bluetooth
http://www.a7eng.com/products/bluetooth/productpages/eb500-ser.htm.
Actually I don't have any experience on setting the bluetooth using pic16f877a. But I found a bluetooth driver that I think can be use in my project.
http://www.ccsinfo.com/forum/viewtopic.php?t=31248&highlight=bluetooth.
But I found out that the driver may be used for serial port bluetooth module. Is there any other drivers for this module? I already search at the another forum, but got no result.
Also I just want to know on how to write up a code for the pic to create a connection (handshake) between module and laptop. I heard that we can set it by only adjust the ic settings at the module or do some basic stamp which I don't know what software should I use to program the basic stamp. hopefully someone can give me some idea on how to do the connection between laptop and module.
Last edited by kazama on Wed Sep 16, 2009 2:50 am; edited 1 time in total |
|
|
kazama
Joined: 01 Sep 2009 Posts: 10 Location: Malaysia
|
Here my code |
Posted: Wed Sep 16, 2009 2:49 am |
|
|
Code: |
#include <16f877a.h>
#fuses hs,nowdt,noprotect,nolvp
#use delay (clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#byte TXSTA=0x98
#byte RCSTA=0x18
#byte SPBRG=0x99
#byte TXREG=0x19
#byte RCREG=0x1A
#byte PIR1=0x0C
#bit TXEN=TXSTA.5
#bit BRGH=TXSTA.2
#bit SYNC=TXSTA.4
#bit CREN=RCSTA.4
#bit SPEN=RCSTA.7
#bit TXIF=PIR1.4
#bit RCIF=PIR1.5
#byte portc=7
unsigned char a;
void display(unsigned char c) // subrountine to display the text on the screen
{
while (TXIF == 0);
TXREG = c;
}
unsigned char receive(void) // subrountine to receive text from PC
{
while (RCIF == 0);
a = RCREG;
return a;
}
void init(void) // subroutine to initialize
{
SPBRG=0x81;
BRGH=1;
TXEN=1;
CREN=1;
SPEN=1;
SYNC=0;
set_tris_c(0x01000000);
}
void main()
{
init();
while(true) // wait for 'ok' to be entered
{
a = receive();
if (a == 'd')break;
}
display('H');
}
|
could someone check the code. i'm using eb500 bluetooth module driver and PIC16F877A. i can see the 'H' on the hyperterminal. help me please |
|
|
|