Techtone
Newbie level 4

- Joined
- May 25, 2010
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- South East England
- Activity points
- 1,359
Hi,
I am working on a project using Microchip P18F2455.
In my project I have several source files, including one named irqhigh.c which handles a timer interrupt.
My main source file is called main.c.
I am at a loss knowing how to declare a variable which can be accessed by both of the source files. Basically, I need to set a variable upon detection of a button press by the debounce routine in irqhigh.c, I then need to be able to read the same variable from the code in main.c.
I have looked at #pragma udata directive and the static keywords, but am just at a loss as to knowing how and where to declare this variable I need.
Sorry if it seems a daft question. I am new to C and Microchip C18, but have many years of PIC assembler experience.
Thanks in advance for any suggestions.
Tony
I am working on a project using Microchip P18F2455.
In my project I have several source files, including one named irqhigh.c which handles a timer interrupt.
My main source file is called main.c.
I am at a loss knowing how to declare a variable which can be accessed by both of the source files. Basically, I need to set a variable upon detection of a button press by the debounce routine in irqhigh.c, I then need to be able to read the same variable from the code in main.c.
I have looked at #pragma udata directive and the static keywords, but am just at a loss as to knowing how and where to declare this variable I need.
Sorry if it seems a daft question. I am new to C and Microchip C18, but have many years of PIC assembler experience.
Thanks in advance for any suggestions.
Tony