Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/09/04 13:35
Modified:
  12/09/04 13:35

Read: times


 
#82825 - variables, main and ISR
Responding to: ???'s previous message
1)is it possible to share a global static varaible in the ISR and the main function?

2)i tried it alot and the compiler keeps telling about some data overflow.


2) The overflow is "too many variables", not their use, move some from DATA to IDATA or XDATA.

1)
yes and no
if the variable is "common" e.g. a pointer incremented in the ISR and read and decremented in the main - yes
if the variable is "shared" and has different purposes in main and the ISR - no.

Beware
for common (see above) variables more than one byte long you MUST disble the assiciated interrupt(s) while using it in main.

Erik

List of 19 messages in thread
TopicAuthorDate
89s52 function sharing.            01/01/70 00:00      
   Try This            01/01/70 00:00      
      emphasis            01/01/70 00:00      
         an idea...            01/01/70 00:00      
            Andy, I tried it            01/01/70 00:00      
               Jolly good!            01/01/70 00:00      
            Error            01/01/70 00:00      
               You need to work on it            01/01/70 00:00      
   reentrant ?            01/01/70 00:00      
      reentrant            01/01/70 00:00      
   non-reentrant            01/01/70 00:00      
   Wow            01/01/70 00:00      
   varaible sharing?            01/01/70 00:00      
      Variable sharing            01/01/70 00:00      
      Overflow            01/01/70 00:00      
      variables, main and ISR            01/01/70 00:00      
         Globals use more memory            01/01/70 00:00      
      Isn't that a global?            01/01/70 00:00      
         Globals, ISRs, main, & static            01/01/70 00:00      

Back to Subject List