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

Back to Subject List

Thread Closed: Another thread already exists on this topic

???
05/05/03 20:29
Read: times


 
#44856 - RE: multi-tasking in software
Responding to: ???'s previous message
Below is a quick code block which is not compiled, tested, even not thought on it detailed...

void timer_interrupt() interrupt 0 {
   in = P2;
   delta = old_in ^ in;
   old_in = in;

   for (int i=0; i<4; i++) {
      delta = delta >> 1;

      // state change?
      if (CY) {
         state_flag[i] = 1;        
         in = in >> 1;
         val[i] = CY;
         counter[i] = 0;
         cntr_flag[i] = 0;
      } else
         in = in >> 1;

      // incr counter?      
      if (!flag[i]) 
         if (counter[i]++ == thresh[val[i]])
            cntr_flag[i] = 1;
   }
}

void main() {
   while (1) {
      for (int i=0; i<4; i++) {
         if (state_flag[i] || cntr_flag[i]) {
            // diable interrupt
            state_flag[i] = cntr_flag[i] = counter[i] = 0;
            // enable interrupt

            process_event(i); // do whatever you want
         }
      }   
   }
}


is it completely garbage?

List of 27 messages in thread
TopicAuthorDate
multi-tasking in software            01/01/70 00:00      
   RE: multi-tasking in software            01/01/70 00:00      
   RE: multi-tasking in software            01/01/70 00:00      
   RE: multi-tasking in software            01/01/70 00:00      
      a example will really provide help            01/01/70 00:00      
         RE: a example will really provide help            01/01/70 00:00      
            RE: a example will really provide help            01/01/70 00:00      
               RE: a example will really provide help            01/01/70 00:00      
                  only bit monitoring software            01/01/70 00:00      
                     RE: only bit monitoring software            01/01/70 00:00      
                        RE: only bit monitoring software            01/01/70 00:00      
                           I promise this Forum            01/01/70 00:00      
                              RE: I promise this Forum            01/01/70 00:00      
                           RE: only bit monitoring software            01/01/70 00:00      
                              Michael Karas your the best            01/01/70 00:00      
                                 RE: Michael Karas your the best            01/01/70 00:00      
                                    RE: Michael Karas your the best            01/01/70 00:00      
   RE: multi-tasking in software            01/01/70 00:00      
   RE: multi-tasking in software            01/01/70 00:00      
      multi-tasking in software - Introspect            01/01/70 00:00      
   Another promise broken...            01/01/70 00:00      
      RE: Another promise broken...            01/01/70 00:00      
         RE: Another promise broken...            01/01/70 00:00      
            RE: Another promise broken...            01/01/70 00:00      
               OK some suggestions on this            01/01/70 00:00      
                  RE: OK some suggestions on this            01/01/70 00:00      
   RE: multi-tasking in software            01/01/70 00:00      

Back to Subject List