Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to interface JY MCU Bluetooth 1.03 module with 89c51 or 89s52

Status
Not open for further replies.
Make sure it works with 6V. In the datasheet you sent it is mentioned that V range is 3.3V to 4.2V.
hi jay
i am trying with this code plz check is is this correct or not .and i still using your ptotues file and i assume that that virtual terminal work as bluetooth module ..

- - - Updated - - -

Make sure it works with 6V. In the datasheet you sent it is mentioned that V range is 3.3V to 4.2V.
hi jay
i am trying with this code plz check is is this correct or not .and i still using your ptotues file and i assume that that virtual terminal work as bluetooth module ..
#include<reg51.h>
//#define DATA P1 //DATA bus is named for Port 2 (8-bit)

void delay(int n); //universal Delay routine for your code; can be customised for your use.
void s_inst(void); //Send Instruction Function Select routine
void s_data(void); //Send Data Select routine
void s_latch(void); // Latch Data/Instruction on LCD Databus
sbit rs= P3^5;
sbit rw= P2^1;
sbit en= P3^4;
sbit rx= P3^1;
sbit tx= P3^0;

void lcdcmd(unsigned char value)
{
P1=value;
rs=0;
rw=0;
en=1;
//mdelay(1);
en=0;
}

void lcd_data(unsigned char value)
{

P1=value;
rs=1;
rw=0;
en=1;
//mdelay(1);
en=0;
}
void lcd_init()
{
lcdcmd(0x38);
//mdelay(250);
lcdcmd(0x0F);
//mdelay(250);
lcdcmd(0x01);
//mdelay(250);
lcdcmd(0x06);
lcdcmd(0x0C);

}
//mdelay(250);

void recieve() //for recive serial data
{
unsigned char value;
while(RI==0);
value=SBUF;
P1=value;
RI=0;
}



void transmit()//for trasmitt data
{
P2=P1-32;
SBUF=P2;
while(TI==0);
TI=0;
SBUF=P1;
while(TI==0);
TI=0;
}
void uart_init()
{
TMOD=0x20;
TH1=0xFD;
SCON=0x50;
TR1=1;
//EA = 1;
//ES = 1;
}



void main()
{

unsigned char i;
unsigned char mes1[10]="Trans mode";
unsigned char mes2[10]="Reciv mode";
uart_init();


lcd_init();



if(rx==1)
{ rx=1;
recieve();
for(i=0;i<=10;i++)
{
//
// DATA=mes2; //It will send y[0]='F' as = 0x45 on Port 2.
// s_latch();

SBUF=mes2;

lcd_data(mes2);
while(RI==1)
RI=1;

}

}
else if(tx==1)
{
tx=1;

transmit();
for(i=0;i<10;i++)
{
// DATA=mes1; //It will send y[0]='F' as = 0x45 on Port 2.
// s_latch();

SBUF=mes1;
lcd_data(mes1);
while(TI==0)

TI=0;

}
}
/* for(i=0;i<8;i++)
{
lcd_data(mes1);
} */
}
void delay(int n) //Universal delay routine
{
int a=0,s=0;
for(a=0;a<=n;a++)
for(s=0;s<=10;s++);
}

void s_inst(void) //Instruction select routine
{
rs=0;

}
void s_data(void) // Data select routine
{
rs=1;

}
/*void s_latch(void) // Latch routine
{
en=1;
delay(10);
en=0;
delay(10);
} */

// END of program
 

What do you want to do? Send data or receive data or both? For receiving you have to use Serial Interrupt. Check example code at saeedsolutions.blogspot.com
hi jay
i want send and recive rs232 data via bluetooth and also trap that bluetooth activity suppose bluetooth is sending data then it may be sow on lcd like "BT is in RX mode"
can uderstand my aim?

- - - Updated - - -

What do you want to do? Send data or receive data or both? For receiving you have to use Serial Interrupt. Check example code at saeedsolutions.blogspot.com
hi jay
i want send and recive rs232 data via bluetooth and also trap that bluetooth activity suppose bluetooth is sending data then it may be sow on lcd like "BT is in RX mode"
can uderstand my aim?
 

While sending data make a flag 1 and while receiving data make another flag 1. Depending upon the status of these flags print "BT Sending..." or "BT Receiving..." on LCD.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top