Hi,
I would like to retrieve some value from my external interrupt handler. The external interrupt handler goes through different states and I would like to evaluate some value inside the interupt handler from outside the interrupt handler and also from another sourcefile/module.
I use (in the interrupt module): volatile unsigned char myByte;
I use (in the evaluating module): extern volatile unsigned char myByte;
In the module during evaluating of 'myByte' I disable the external interrupt.
But I still do not get the correct value.
Where do I go wrong?
Henk
typedef unsigned char data_type; // assign as required
Not So fast.
If the global is a char or bit your code is OK. But if is an int or larger it will not be atomic for an 8052. The main() functions would have to disable interrupts or take other action to insure proper operation.
The typedef statement still applies regardless of the data size chosen: the code will work with more than 1-bit or 8-bits... like a long, etc. (please re-read the post)
--Cpt. Vince Foster c/o VRWC (founding member) 2nd Cannon Place Fort Marcy Park, VA
Yes it does. My mistake