Why xbee communication is not satisfied, I do not understand. The reason is like complicated. Can you help me ?
I have send data as ;
TXREG = 'e';
I have xbee coordinator connected via usb to my desktop. In it, python xbee api works.
In the pic development kit I have connected regulated to the rs435, extension socket, dout/in pins. On regulated, xbee end point.
| | | | | | | TX RX GND VCC | | DIN DOUT RA3 GND VCC | | | | RC5 RC5 RC2 SCL SDA | | | extension socket regulated
I have configured my xbee coordinator as ;
57600 api mode destination address dl = ffff dh = 0
I have configured my xbee end point as ;
57600 baud rate at mode destination address is coordinator address
I have configured Pic18f4520 as ;
FSR0H = 0; FSR0L = 0; /* User setting : actual PIC frequency */ Tmr0.lt = _20MHZ; /* Timer OFF - Enabled by Kernel */ T0CON = 0x08; TMR0H = Tmr0.bt; TMR0L = Tmr0.bt; /* configure ADC unit */ TRISD = 0; TRISA = 1 ; ADCON0bits.CHS2 = 0; ADCON0bits.CHS1 = 0; ADCON0bits.CHS0 = 0; ADCON2bits.ADCS1 = 1; ADCON2bits.ADCS0 = 1; ADCON2bits.ADFM = 1; ADCON1bits.PCFG0 = 0; ADCON1bits.PCFG1 = 1; ADCON1bits.PCFG2 = 0; ADCON1bits.PCFG3 = 0; ADCON0bits.ADON = 1; // set all ports of PortD as output TRISE = 0; // set all ports of PortE as output PORTD = 0; PORTE = 0; // clear PortE /* configure USART transmitter/receiver */ SPBRG = 21; // for 20 MHz, to have 57600 baud rate, it should be 21 TXSTA = 0x04; // (= 00000100) 8-bit transmit, transmitter NOT // enabled, asynchronous, high speed mode RCSTA = 0x90; // (= 10010000) 8-bit receiver, receiver enabled, // continuous receive, serial port enabled /* configure the interrupts */ INTCON = 0; // clear interrupt register completely INTCONbits.INT0IE = 0 ; RCONbits.IPEN = 1 ; // Enable priority levels on interrupts /*portb interrupts end*/ TRISB = 0x3E; INTCON2bits.RBPU = 0 ; PORTB = 0 ; PIE1bits.TXIE = 1; // enable USART transmit interrupt PIE1bits.RCIE = 1; // enable USART receive interrupt PIR1 = 0; // clear all peripheral flags INTCONbits.PEIE = 1; // enable peripheral interrupts INTCONbits.GIE = 1; // globally enable interrupts