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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/12/01 18:35
Read: times


 
#8174 - RE: does anyone know the reason
The fear of using global variables is from the possibility of an interrupt routine modifying an int, long, or other multi-byte global variable while a foreground task is reading it.

Imagine reading a 16-bit memory pointer, 0x12FF, to access a table. The program reads the low byte, 0xFF, interrupt routine increments the pointer to 0x1300, returns, and then the main program reads the high byte, now 0x13. Problem.

I usually use a global bit variable "HandsOff" that I set before reading certain globals and clear when the interrupt is able to modify them.

-- Tom Bachmann

List of 19 messages in thread
TopicAuthorDate
does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      
RE: does anyone know the reason            01/01/70 00:00      

Back to Subject List