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.

[moved] XBEE module is not responding.

Status
Not open for further replies.

Prakash.143

Junior Member level 1
Joined
Nov 24, 2015
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
165
Dear Sir,
I designed a XBEE controlled robot but it is not working.When i am pressing keys from laptop it is sending data but in receiver the XBEE module is not receiving but the XBEE is tested anf ok. Here i am using ATMEGA16 microcontroller and interfacing through USART protocol and below program.
Connection settings of the Kit

xbee is connected with the Serial Port of the MCU
VCC ----> +5v
RX ----> TX (PD1)
TX ----> RX (PD0)
GND ----> GND pin of th MCU

Left Motor ----->PB0,PB1
Right Motor ----->PB2,PB3

16x2 LCD connection
Pin 1 -----> GND
Pin 2 -----> VCC(+5v)
VEE -----> Connected with Variable resistor
RS --------> PC0
RW --------> PC1
E --------> PC2
D0,D1,D2 & D3 Not Used
D4 --------> PC4
D5 --------> PC5
D6 --------> PC6
D7 --------> PC7
Pin 15-----> Vcc(+5v)
Pin 16-----> GND

BOOTLooder Condition Check--->PA0(If 0 bootler section else program execution section of Flash memory)
Crystal Ossilator(12MHz)----->XTAL1,XTAL2
VB=Battery Supply
VCC=regulated 5V+
Gnd=Ground(0V)


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
*/
 
#define  F_CPU 12000000UL                               // define clock speed of the MCU
#include <avr/io.h>                                     // include avr header file
#include <util/delay.h>                                 // include delay header file
#include "lcd_16.h"                                     // include LCD header file 
#include "lcd_16.c"                                     // include LCD.C file
 
void USARTInit(unsigned int ubrr_value)                 // USART initialize
{
/*
Baud rate = 9600
Data bits =8
Parity = None
Stop bits = 1
Flow Control = None
Transmission Mode = Asynchronous
USART Reciever = ON
USART Transmitter = ON
U2X = 0
UBRR value = 77
 
ATMega16 Calibrated Internal RC Oscilator Frequency = 12 MHz
 
*/
 
UBRRL = ubrr_value;    
UBRRH = 0;
UCSRC|=(1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0);
UCSRB=(1<<RXEN)|(1<<TXEN);                              // Enable Receiver & Transmitter
}
 
unsigned char USARTReadChar()                           // UART recieving function
{
 while(!(UCSRA & (1<<RXC)));                            // Wait till the receiving  is not completed.
 return UDR;                                            // Return the received data
}
 
void USARTTransmitChar(unsigned char data)              // UART transmit function
{
 while(!(UCSRA & (1<<UDRE)));                           // Wait till the data  register is not Empty.
 UDR=data;                                              // put the data to be transfer
}
 
void USART_StringTransmit(unsigned char s[])            // String transmit function
{
 int i=0;
 while(s[i]!='\0')
 {
 USARTTransmitChar(s[i]);
 i++;
 }
}
 
 
 
void main()                                             // main function
{
DDRB=0b00011111;                                        // declare Port B as a output port connected to the motors
DDRD=0b00000000;                                        // declare Port D as a input port connected to the xbee
 
unsigned char command;
 
USARTInit(77);                                          // 9600-Baud Rate at 12Mhz  
_delay_ms(100);
lcd_init(LCD_DISP_ON);                                  // LCD initialization
lcd_gotoxy(0,0);                                        // select the position of the text
lcd_puts("System is Ready");                            // Print the Text
lcd_gotoxy(0,1);                                        // select the position of the text
lcd_puts("  Send  Data   ");                            // print the text
_delay_ms(100);
 
while(1) 
    {   
     command=USARTReadChar();                           // waiting to receive new command
     PORTB=0b00010000;                                  // Buzzer ON 
     
     if((command=='f')||(command=='F'))
     {   
     PORTB=0b00001001;                                  // Move Forward
     USART_StringTransmit("\n\r Moving Forward...");    // string transmit
     lcd_clrscr();
     lcd_gotoxy(0,0);
     lcd_puts("Move Forward");
     }
 
     if((command=='b')||(command=='B'))
     {   
     PORTB=0b00000110;                                  // Move Backward
     USART_StringTransmit("\n\r Moving Backwards...");  // string transmit
     lcd_clrscr();
     lcd_gotoxy(0,0);
     lcd_puts("Move Backward");
     }
 
     if((command=='r')||(command=='R'))
     {   
     PORTB=0b00010001;                                  // Turning Right
     USART_StringTransmit("\n\r Turning Right...");     // string transmit
     lcd_clrscr();
     lcd_gotoxy(0,0);
     lcd_puts("Turn Right");
     }
 
     if((command=='l')||(command=='L'))
     {   
     PORTB=0b00011000;                                  // Turning Left
     USART_StringTransmit("\n\r  Turning Left...");     // string transmit
     lcd_clrscr();
     lcd_gotoxy(0,0);
     lcd_puts("Turn Left");
     }
 
     if((command=='s')||(command=='S'))
     {   
     PORTB=0b00000000;                                  // Stop
     USART_StringTransmit("\n\r  STOPPED  !!...");      // string transmit
     lcd_clrscr();
     lcd_gotoxy(0,0);
     lcd_puts("Stop");
     }
 
    
    }
 
}

 
Last edited by a moderator:

Re: XBEE module is not responding.

Have you mixed up rx and tx?
Why is RX connected to TX and vice versa?

The XBEE connections are named "DIN" and "DOUT". "DIN" should be connected to the TX pin of the MCU.
 

Re: XBEE module is not responding.

Yes it is connected according to you, but i am not getting any data from DOUT pin of XBEE module.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top