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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/25/03 09:18
Read: times


 
#40012 - RE: This has me puzzled. (A/D code problem)
Responding to: ???'s previous message
Keith:
I cannot really tell what might be wrong with your code. But there was one thing I wanted to share with you.

It is considered very dangerous programming practice to treat the processor registers as a global variables that are setup in an interrupt routine and then referenced in the mainline code..(or the opposite, set in mainline and referenced in the interrupt). It is far better to find a way to give the interrupt routine a job to do and have it perform this job in a standalone way. If there are results to store or values to fetch for the interrupt to work with then those should be placed in other non-register RAM.

The technigue you are using now, you will soon see, leads to an overall program that is hard to manage and maintain. The processor registers should be considered a scratch pad memory work area for within a subroutine or local block of code or in an interrupt routine. The problems you will have of trying to maintain some fixed allocations for across a whole program will become abundantly clear if you try to add on some new code that is writtem i in C.

Michael Karas


List of 7 messages in thread
TopicAuthorDate
This has me puzzled. (A/D code problem)            01/01/70 00:00      
   RE: This has me puzzled. (A/D code problem)            01/01/70 00:00      
   RE: This has me puzzled. (A/D code probl            01/01/70 00:00      
      If I set bit 3 of ADCON,            01/01/70 00:00      
         RE: If I set bit 3 of ADCON,            01/01/70 00:00      
            I figured out what was wrong...            01/01/70 00:00      
               RE: I figured out what was wrong...            01/01/70 00:00      

Back to Subject List