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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/08/08 13:37
Read: times


 
#160720 - Here are some guide lines...
Responding to: ???'s previous message
Hi,
You don't need multitasking for that!!! This is a pretty simple job for microcontrollers.
I will just give the brief information(NOT in Detail....you can work out the details). Here goes..

These things should be completed by you:
1. One program that shows 2008 on the display. Save this code as Screen_1.
2. Second program that shows "the LED's displaying numbers from 0-9999 sequentially on the display". Save this code as Screen_2.
3. Third Program that shows "the voltage across two points should be measured and displayed by the LEDs".Save this code as Screen_3.

Write the above codes in such a way so that you can put all the above programs (source code) in to one single program, by calling them as functions ...something like : Screen1, Screen2, Screen3.etc

4. You should be having your code ready to read the keys and increment a Variable on pressing the key..something like:
  if (Keypressed ())
    {
    if (Screen<3)
       Screen++;
    else
       Screen=1;
    }

 



If the above is ready, then what remains is just simple as cutting a birthday cake. Finally your program should be something like this:

DisplayScreen1()
{
..
..
}

DisplayScreen2()
{
..
..
}

DisplayScreen3()
{
..
..
}


RedKeys()
{
....
  if (Keypressed ())
    {
    if (Screen<3)
       Screen++;
    else
       Screen=1;
    }
...
}

Initialize ()
{
...
Screen=1;
...
}


main (void)
{
Initialize ();
for (;;)
  {
  ...
  ReadKeys ();
  if (Screen==1)  DisplayScreen1();
  if (Screen==2)  DisplayScreen2();
  if (Screen==3)  DisplayScreen3();
  ...
  }
}


 



And yes then the others are ready to sing the Birthday song.

Bye ,
From Kiran V Sutar
Mumbai INDIA.

Please Note:
1. The code is just to explain. You can do the same very easily in Assembly code also, using the same technique mentioned above.
2. This is just one of the many ways in which you an do it.
3. My father was an artist, he used to say that the Best artist is the one who knows where to STOP, otherwise you keep on doing the same painting years and years togather without finishing it.



List of 14 messages in thread
TopicAuthorDate
multitasking using 8051            01/01/70 00:00      
   Seems fairly simple            01/01/70 00:00      
   use a loop            01/01/70 00:00      
   What does it do when NO BUTTONS are pressed?            01/01/70 00:00      
   State machine            01/01/70 00:00      
   Not multitasking?            01/01/70 00:00      
      Scan keys and do accordingly            01/01/70 00:00      
      I am agree with Andy            01/01/70 00:00      
         Guessing?            01/01/70 00:00      
            Guess            01/01/70 00:00      
            Dear, i think you havent fully got my words...            01/01/70 00:00      
   Here are some guide lines...            01/01/70 00:00      
   Is there something wrong on this thread?            01/01/70 00:00      
      Yes It was Revived by John Smith //eom//            01/01/70 00:00      

Back to Subject List