powerworm
Newbie level 2
Hello . Im doing my project using a combination of Zigbee and GPRS Modem G2403 like this :
GPRS modem ------------> Zigbee circuit
^
|
|
PC RS232 cable -----
I am able to communicate with GPRS modem in 2 directions(send command and receive response) and display the conversation on Hyper Terminal . The code is shown below :
The problem is when I use this code in Zigbee Res 2006 project . Only 3 characters can be received by the PIC 18f4620 . I have tried to comment out all the code in main function of Zigbee Res 2006 (except USART code above) but it's no use .The problem only stop when I remove nearly all of the Zigbee files with c extension that included in the project. How can I make it happen without modifying Zigbee code too much ?
GPRS modem ------------> Zigbee circuit
^
|
|
PC RS232 cable -----
I am able to communicate with GPRS modem in 2 directions(send command and receive response) and display the conversation on Hyper Terminal . The code is shown below :
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 #include <p18f4620.h> #include <delays.h> #include <usart.h> #include <portb.h> #include <timers.h> #include <stdlib.h> #include <string.h> #pragma config OSC = HSPLL #pragma config WDT = OFF #pragma config PWRT = OFF int i = 0; char strMsg[8]=""; void rx_handler (void); void int_handler (void); #pragma code RB0_interrupt = 0x8 // High Priority Interrupt void RB0_int (void) { _asm goto rx_handler _endasm } #pragma code #pragma code #pragma interrupt rx_handler void rx_handler (void) { if (PIR1bits.RCIF == 1) // If this interrupt was generated by a receive character (IS THIS CORRECT??) { strMsg[i] = RCREG; // Get the character from the UART PORTA = 0b00000001; WriteUSART(strMsg[i]); i++; } } void main (void) { TRISA = 0b11111110; PORTA = 0b00000000; ConsoleInit(); /* Enable interrupt priority */ RCONbits.IPEN = 1; /* Make RX USART receive interrupt low priority */ PIE1bits.RCIE = 1; IPR1bits.RCIP = 1; /* Enable all high priority interrupts */ INTCONbits.GIEH = 1; /* Enable all low priority interrupts */ putrsUSART("at+cmgr=1\r\n"); while(1) {} }
The problem is when I use this code in Zigbee Res 2006 project . Only 3 characters can be received by the PIC 18f4620 . I have tried to comment out all the code in main function of Zigbee Res 2006 (except USART code above) but it's no use .The problem only stop when I remove nearly all of the Zigbee files with c extension that included in the project. How can I make it happen without modifying Zigbee code too much ?
Last edited: