orhanli1
Junior Member level 1
Hello everybody.
i have a problem about communicating two development board (LV 24-33 and LV 24-33A) with easy-bee module.
Mcu is dsPIC33FJ128GP710 in two of them.
I use LV 24-33 as transmitter(parent) with no LCD.and i want to send "mikroE" string to another board.
this first code is for configuring the transmitter.i turned on lv 24-33 ,sended this code to LV 24-33,turned off LV 24-33,put Easy Bee to LV 24-33 PORTF Low,turned on again for 15 seconds and turned off the LV 24-33,disconnect Easy-bee.it is ready for transmitting.
Then i send the receiver configuration code to another board(LV 24-33A) with LCD.It should display the string on LCD.It is configured as router as in the example.this second code is for configuring the receiver.i turned on lv 24-33A ,sended this code to LV 24-33A,turned off LV 24-33A,put Easy Bee to LV 24-33A PORTF Low,turned on again for 15 seconds and turned off the LV 24-33A,disconnect Easy-bee.it is ready for receiving.
the third code is transmitting code.i turned on lv 24-33 again ,sended this code to LV 24-33,turned off LV 24-33,put Easy Bee to LV 24-33 PORTF Low and it should be ok.
the last is receiving code.and it should be display the string on LCD.i turned on lv 24-33A ,sended this code to LV 24-33A,turned off LV 24-33A,put Easy Bee to LV 24-33A PORTF Low,And it should be ok.
(I change the all codes from Easy-Bee examples from Mikroelektronika)
than i turned on the two board but i dont see anything on LCD.
I understand the whole code except receiver(the last)
and i don't understand what is the purpose of using PORTD
didn't i write the code properly true?
i'm waiting for your replies.
Thanks.
i have a problem about communicating two development board (LV 24-33 and LV 24-33A) with easy-bee module.
Mcu is dsPIC33FJ128GP710 in two of them.
I use LV 24-33 as transmitter(parent) with no LCD.and i want to send "mikroE" string to another board.
this first code is for configuring the transmitter.i turned on lv 24-33 ,sended this code to LV 24-33,turned off LV 24-33,put Easy Bee to LV 24-33 PORTF Low,turned on again for 15 seconds and turned off the LV 24-33,disconnect Easy-bee.it is ready for transmitting.
Code:
// *
// * Project name
// EasyBee Transmitter Initialization
// * Author: Tuna ORHANLI
// * Copyright
// (c); mikroElektronika, 2008
// * Revision History
// 20080225
// - initial release.
// * Description
// This code demonstrates how to configure one EasyBee node to act as a parent in network
// * Test configuration
// MCU: dsPIC33FJ128GP710
// Dev.Board: LV 24-33
// Oscillator: XT, 10.0000 MHz
// Ext. Modules: EasyBee extra board
// SW: mikroC v5.0.1
// * NOTES
// - refer to product AT Command manual for more inforamtions
// - turn off EasyPIC5 development board after loading this aplication into
// dsPIC33FJ128GP710, connect EasyBee on PORTF and turn on the LV 24-33. After
// 10 seconds turn off LV 24-33 and disconnect EasyBee from PORTF. Now
// EasyBee extra board is configured as transmitter
// *
void main() {
ADPCFG = 0xFFFF;
TRISD=0xFFFF;
delay_ms(500);
UART2_init(38400); // initialize USART module
delay_ms(3000); // wait to initialize ZigBee
UART2_Write('A'); // set a node to transmit EVENT and DATA to a host
UART2_Write('T');
UART2_Write('X');
UART2_Write(13); // CR(Satırbaşı)
Delay_ms(1000);
UART2_Write('A'); // set MAC address for the node
UART2_Write('T');
UART2_Write('+');
UART2_Write('G'); //GSN=1 Koordinator için
UART2_Write('S'); //GSN=2 Router(Yönlendirici) için
UART2_Write('N'); //Yani receiver router olarak ayarlanmış
UART2_Write('=');
UART2_Write('1');
UART2_Write(13); // CR(Satırbaşı)
delay_ms(1000);
UART2_Write('A'); // set node’s PAN ID
UART2_Write('T');
UART2_Write('+'); //Bu 1620 değerini atama sabit bir işlem
UART2_Write('W');
UART2_Write('P');
UART2_Write('A');
UART2_Write('N');
UART2_Write('I');
UART2_Write('D');
UART2_Write('=');
UART2_Write('1');
UART2_Write('6');
UART2_Write('2');
UART2_Write('0');
UART2_Write(13); // CR(Satırbaşı)
delay_ms(1000);
UART2_Write('A'); // Set node’s channel mask
UART2_Write('T');
UART2_Write('+');
UART2_Write('W');
UART2_Write('C'); //Bu 10000 değerini atama sabit bir işlem
UART2_Write('H');
UART2_Write('M');
UART2_Write('A');
UART2_Write('S');
UART2_Write('K');
UART2_Write('=');
UART2_Write('1');
UART2_Write('0');
UART2_Write('0');
UART2_Write('0');
UART2_Write('0');
UART2_Write('0');
UART2_Write(13); // CR(Satırbaşı)
delay_ms(1000);
UART2_Write('A'); // switch to coordinator function, set zero address
UART2_Write('T');
UART2_Write('+');
UART2_Write('W');
UART2_Write('R'); //bence switch to router function,set address 55 yazılması lazımdı
UART2_Write('O'); //role 0,0=coordinator role 1,55=router yazıyor
UART2_Write('L');
UART2_Write('E');
UART2_Write('=');
UART2_Write('0');
UART2_Write(' ');
UART2_Write('+');
UART2_Write('W');
UART2_Write('S');
UART2_Write('R');
UART2_Write('C');
UART2_Write('=');
UART2_Write('0');
UART2_Write(13); // CR(Satırbaşı)
delay_ms(1000);
UART2_Write('A'); // enable automatic networking
UART2_Write('T'); // (10 sec timeout is set) and reboot
UART2_Write('+');
UART2_Write('W');
UART2_Write('A');
UART2_Write('U');
UART2_Write('T');
UART2_Write('O');
UART2_Write('N'); //bu da router olsa AT+WAUTONET=1 Z olacaktı
UART2_Write('E');
UART2_Write('T');
UART2_Write('=');
UART2_Write('1');
UART2_Write(' ');
UART2_Write('Z');
UART2_Write(13); // CR(Satırbaşı)
Delay_ms(1000);
UART2_Write('A'); // Set 3 sec timeout to wait for input
UART2_Write('T');
UART2_Write('+');
UART2_Write('W');
UART2_Write('W');
UART2_Write('A'); //bu AT COMMAND SET de yoktu
UART2_Write('I');
UART2_Write('T');
UART2_Write('='); //input için 3 sn bekleme yapıyomuş
UART2_Write('3');
UART2_Write('0');
UART2_Write('0');
UART2_Write('0');
UART2_Write(13); // CR(Satırbaşı)
}
Code:
// *
// * Project name
// EasyBee Reciever Initialization
// * Author: TUNA ORHANLI
// * Copyright
// (c) mikroElektronika, 2008
// * Revision History
// 20080225
// - initial release.
// * Description
// This code demonstrates how to configure one Zigbee node to act as a router
// * Test configuration
// MCU: dsPIC33FJ128GP710
// Dev.Board: LV 24-33A
// Oscillator: XT, 10.0000 MHz
// Ext. Modules: EasyBee extra board
// SW: mikroC PRO V5.0.1
// * NOTES
// - refer to product AT Command manual for more informations
// - turn off EasyPIC5 development board after loading this aplication into
// P18F4520, connect EasyBee on PORTC and turn on the EasyPIC5. After
// 10 seconds turn off EasyPIC5 and disconnect EasyBee from PORTC. Now
// EasyBee extra board is configured as reciever
// *
void main() {
ADPCFG = 0xFFFF;
TRISD=0x0000;
delay_ms(500);
UART2_init(38400); // initialize USART module
delay_ms(3000); // wait to initialize ZigBee
UART2_Write('A'); // set a node to transmit EVENT and DATA to a host
UART2_Write('T');
UART2_Write('X');
UART2_Write(13); // CR(Satırbaşı)
Delay_ms(1000);
UART2_Write('A'); // set MAC address for the node
UART2_Write('T');
UART2_Write('+');
UART2_Write('G'); //GSN=1 Koordinator için
UART2_Write('S'); //GSN=2 Router(Yönlendirici) için
UART2_Write('N'); //Yani receiver router olarak ayarlanmış
UART2_Write('=');
UART2_Write('2');
UART2_Write(13); // CR(Satırbaşı)
delay_ms(1000);
UART2_Write('A'); // set node’s PAN ID
UART2_Write('T');
UART2_Write('+'); //Bu 1620 değerini atama sabit bir işlem
UART2_Write('W');
UART2_Write('P');
UART2_Write('A');
UART2_Write('N');
UART2_Write('I');
UART2_Write('D');
UART2_Write('=');
UART2_Write('1');
UART2_Write('6');
UART2_Write('2');
UART2_Write('0');
UART2_Write(13); // CR(Satırbaşı)
delay_ms(1000);
UART2_Write('A'); // Set node’s channel mask
UART2_Write('T');
UART2_Write('+');
UART2_Write('W');
UART2_Write('C'); //Bu 10000 değerini atama sabit bir işlem
UART2_Write('H');
UART2_Write('M');
UART2_Write('A');
UART2_Write('S');
UART2_Write('K');
UART2_Write('=');
UART2_Write('1');
UART2_Write('0');
UART2_Write('0');
UART2_Write('0');
UART2_Write('0');
UART2_Write('0');
UART2_Write(13); // CR(Satırbaşı)
delay_ms(1000);
UART2_Write('A'); // switch to coordinator function, set zero address
UART2_Write('T');
UART2_Write('+');
UART2_Write('W');
UART2_Write('R'); //bence switch to router function,set address 55 yazılması lazımdı
UART2_Write('O'); //role 0,0=coordinator role 1,55=router yazıyor
UART2_Write('L');
UART2_Write('E');
UART2_Write('=');
UART2_Write('1');
UART2_Write(' ');
UART2_Write('+');
UART2_Write('W');
UART2_Write('S');
UART2_Write('R');
UART2_Write('C');
UART2_Write('=');
UART2_Write('5');
UART2_Write('5');
UART2_Write(13); // CR(Satırbaşı)
delay_ms(1000);
UART2_Write('A'); // enable automatic networking
UART2_Write('T'); // (10 sec timeout is set) and reboot
UART2_Write('+');
UART2_Write('W');
UART2_Write('A');
UART2_Write('U');
UART2_Write('T');
UART2_Write('O');
UART2_Write('N'); //bu da router olsa AT+WAUTONET=1 Z olacaktı
UART2_Write('E');
UART2_Write('T');
UART2_Write('=');
UART2_Write('1');
UART2_Write('0');
UART2_Write(' ');
UART2_Write('Z');
UART2_Write(13); // CR(Satırbaşı)
portd=1;
}
Code:
// *
// * Project name
// EasyBee Transmiter
// * Author: Tuna ORHANLI
// * Copyright
// (c) mikroElektronika, 2008
// * Revision History
// 20080225
// - initial release.
// * Description
// In this example we a show you how to recieve data from EasyBee and print it on LCD.
// * Test configuration
// MCU: dsPIC33FJ128GP710
// Dev.Board: LV 24-33
// Oscillator: XT, 10.00 MHz
// Ext. Modules: -
// SW: mikroC PRO v5.0.1
// * NOTES
// - connect EasyBee on PORTF after loading this aplication into dsPIC33FJ128GP710
// *
void main() {
ADPCFG = 0xFFFF;
TRISD=0xFFFF;
delay_ms(500);
UART2_init(38400); // initialize USART module
delay_ms(3000);
while (1) {
UART2_Write('A'); // send AT command for sending Data
UART2_Write('T');
UART2_Write('D');
UART2_Write(' '); //ATD 55 komutu 55. adresten bilgiyi gönderir
UART2_Write('5'); //gönderilecek data hemen altına yazılır
UART2_Write('5');
UART2_Write(13); // CR
delay_ms(1000);
UART2_Write('m'); // data
UART2_Write('i');
UART2_Write('k'); //55. adresten mikroE stringi gönderiliyor
UART2_Write('r');
UART2_Write('o');
UART2_Write('E');
UART2_Write(13); // CR
delay_ms(5000);
}
}
the last is receiving code.and it should be display the string on LCD.i turned on lv 24-33A ,sended this code to LV 24-33A,turned off LV 24-33A,put Easy Bee to LV 24-33A PORTF Low,And it should be ok.
Code:
// *
// * Project name
// EasyBee reciever
// * Author: Tuna ORHANLI
// * Copyright
// (c) mikroElektronika, 2008
// * Revision History
// 20080225
// - initial release.
// * Description
// in this example we show you how to recieve data from EasyBee and print it on LCD.
// * Test configuration
// MCU: dsPIC33FJ128GP710
// Dev.Board: LV 24-33A
// Oscillator: XT, 10.0000 MHz
// Ext. Modules: 2x16 LCD, EasyBee extra board
// SW: mikroC v8.2
// * NOTES
// - connect LCD on your EasyPIC5, EasyBee on PORTF after loading this
// aplication into P18F4520
// *
// Lcd module connections
sbit LCD_RS at LATB2_bit;
sbit LCD_EN at LATB3_bit;
sbit LCD_D4 at LATB4_bit;
sbit LCD_D5 at LATB5_bit;
sbit LCD_D6 at LATB6_bit;
sbit LCD_D7 at LATB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End Lcd module connections
char txt[50], txt1[50], txt2[50];
unsigned short i,j,tmp;
void main() {
ADPCFG = 0xFFFF; // Configure AN pins as digital I/O
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);
TRISA = 1;
PORTA = 0;
TRISD = 0;
PORTD = 0;
Delay_ms(1000);
UART2_init(38400); // initialize USART module
// turn cursor off
delay_ms(2000); // wait 2sec to initialize ZigBee
while (1) {
tmp = 0;
i = 0;
memset(txt, 0, 50); // clear array of char
memset(txt1, 0, 50); // clear array of char dizileri temizler
memset(txt2, 0, 50); // clear array of char
do {
if (UART2_Data_Ready() != 0) {
tmp = UART2_Read();
txt[i] = tmp;
portd = i;
i++;
}
if (tmp == 10)
break;
}
while (tmp != 13);
if (tmp == 13) {
Lcd_Cmd(_LCD_CLEAR); // clear display
txt[i-1] = 0; // repare data for displaying
Strncpy(txt1, txt, 13); //txt nin ilk 13 karakterini txt1 e atar.
}
for (j=0; j<=15; j++) {
txt2[j] = txt[j+14];
}
txt2[11]=0;
Lcd_out(1,1, txt1); // print text to LCD, 1st row, 1st column
Lcd_out(2,1, txt2); // print text to LCD, 2st row, 1st column
}
}
(I change the all codes from Easy-Bee examples from Mikroelektronika)
than i turned on the two board but i dont see anything on LCD.
I understand the whole code except receiver(the last)
and i don't understand what is the purpose of using PORTD
didn't i write the code properly true?
i'm waiting for your replies.
Thanks.