----- Original Message ----- From: Michael Rigby-Jones To: Sent: Tuesday, November 07, 2000 4:05 AM Subject: Re: [PIC]: Multibyte words and Interrupts > > -----Original Message----- > > From: Andrew Kunz [SMTP:akunz@TDIPOWER.COM] > > Sent: Monday, November 06, 2000 4:12 PM > > To: PICLIST@MITVMA.MIT.EDU > > Subject: Re: [PIC]: Multibyte words and Interrupts > > > > Yes, and it's rather simple. > > > > > > DI (); // entering critical section > > > > EI (); // ISR can use them now. > > > > Andy > > > > > > > The trouble is, because the main loop is pretty much only updating these > variables, the interrupts would be disabled most of the time! Yeah, but that's Ok, as long as they aren't disabled for more than a few instructions at a time. Here is my recommendation: Create a 'database' to hold your values. As I understand it, interrupt level code needs to read these values, but never writes them. As you poll the analogs you simply DI() / EI() around _each_ individual write of a value to the database. You structure your code to minimize the number of instructions required while DI()'d. You'd probably have a work area, used only by task level code, that holds just the one value you are currently 'scanning'. Remember, as soon as you EI(), if there are any pending interrupts, they _will_ be taken. From the point of view of task level code you could indeed be DI()'d almost all the time, but the interrupt level code will be able to get control any time it needs to, almost immeidately. > Mike > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu