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.

Interfacing Bluetooth HC-05 with PIC18F452 using SENA BTerm apk

Status
Not open for further replies.

tarjina

Junior Member level 3
Joined
Jun 7, 2012
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,536
Hello guys,
I'm new here. Please help me out. I'm trying to connect PIC18F452 to android phone via bluetooth HC-05 module (can work as master and slave). I'm trying to send the data but it's not working. I'm coding in mikroC and UART library. Does anyone here can help me please???
Here's my code:
char uart_rd;
void main() {
TRISA=0X00;
TRISD=0X00;
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize

while(1){
if (UART1_Data_Ready()) { // If data is received,
PORTD=0XFF;
uart_rd = UART1_Read(); // read the received data,
if(uart_rd=='1'){
PORTA=0X05;
delay_ms(5000);
PORTD=0X0F;
delay_ms(1000);

}
else if(uart_rd=='2'){
PORTA=0X0C;
delay_ms(5000);
PORTD=0X0F;
delay_ms(1000);
}
else if(uart_rd=='3'){
PORTA=0X24;
delay_ms(5000);
PORTD=0X0F;
delay_ms(1000);
}
else if(uart_rd=='4'){
PORTA=0X06;
delay_ms(5000);
PORTD=0X0F;
delay_ms(1000);
}
}
else
{PORTA=0X00;}
}
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top