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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/12/10 21:23
Read: times


 
#180106 - flags, semaphors and so on
Responding to: ???'s previous message
Suppose Your device is playing song.
Song is 2- dimensional array(note freq,note length) with some lenght .
Suppose Timer0
- checks flag "ACTIVESONGPLAYING" . If flag is true - timer0
downcounts length of default note. When note expires , Timer0 increments pointer in array
and extracts next note's length and frequency.
- In same time this timer monitors 'mode button'.If button is detected - some flag "MODECHANGEREQUEST" is fired in Timer0 interrupt.

Main routine will see flag "MODECHANGEREQUEST" and will change mode, if in this mode song is disabled -
"ACTIVESONGPLAYING" will be cleared.

Timer1 will play notes - it should be with highes priority (for clearer sound).
Timer1 can be enabled permanently (and should check flag ACTIVE_SOUND_ENABLED) or can be enabled/disabled by main loop.

List of 8 messages in thread
TopicAuthorDate
Using Interrupts to call functions            01/01/70 00:00      
   what is Your target?            01/01/70 00:00      
      Responding to: Stefan Kanev's previous message            01/01/70 00:00      
         big task            01/01/70 00:00      
            The next question            01/01/70 00:00      
               flags, semaphors and so on            01/01/70 00:00      
         Endless loops            01/01/70 00:00      
            main            01/01/70 00:00      

Back to Subject List