Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Using Usart interupt in zigbee res 2006 source code from microchip

Status
Not open for further replies.

powerworm

Newbie level 2
Joined
Oct 21, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,302
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 :


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:

powerworm

Newbie level 2
Joined
Oct 21, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,302
Anybody know about my problem, please help me ???
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top