Post by Admin on May 27, 2016 3:11:43 GMT
SO What is polling ?
Polling is in which the processor waits for an instruction to be high. In this process, the IC has nothing else but to repeat the same instruction again and again
until and unless the required OUTPUT is obtained, in order to jump to the next statement. The process of polling demands high processing time and basically this stops the processor from doing anything else. And is therefore a very unused factor. This is where interrupts come in handy, An interrupt is raised and thus the processor carries out a new instruction. For example : Consider the case in which you are driving a car , Suddenly another car comes and hits your car.Thus that
acts an interrupt and this raises your car to pull out the balloon and brake.
So, BUT INTERRUPTS are already available in the ATMEGA processors ( AVR ). Turns out you need to solder the rest to obtain a working concept of ARDUINO.
I have honestly never implemented INTERRUPTS in ATMEGA although, IN 2-2 you all will mostly employ interrupts. The KEYBOARD in your laptop! They are basically interrupts from the basic routine the microprocessor undergoes. If it was polling. Each key had to be polled. Imagine THAT!!
So far so good, polling is okhay in arduino as it has a 16Mhz 8 bit processor. Which is fair enough for polling unless you arent doing any high processing code.Which you most likely willnot. Rather get a x86 processor and code it in ASM. ( you will study it in 2-2 once again )
A code for polling :
Someone implement this code and try to observe , how the working is. I didnot get time to check and see myself. Sorry juniors. But, I hope you get the point of what i am trying to convey here. GIVE A DELAY AFTER THIS, OTHERWISE, THE NEXT getkey() WILL TAKE IN THE SAME VALUE, AS a press can be more than 200 clock cycles. If you know what that means! A delay of atleast 2 secs should be taken. REMEMBER THIS IS NOT INTERRUPTS.
QUESTION : MAKE A POV Arduino light. use minimum 6 leds, in a straight line and write a code to make alphabets appear in air, when you move them in a single direction. For help on what i am trying to convey is CHECK HERE
REMEMBER Persistence Of Vision is 1/16th of sec, Which means, if you move any LED a distance under 1/16th of second. It reads as a straight line. > A lot of codes are available out there. Try to come up with your own.! HAVE FUN!!
Polling is in which the processor waits for an instruction to be high. In this process, the IC has nothing else but to repeat the same instruction again and again
until and unless the required OUTPUT is obtained, in order to jump to the next statement. The process of polling demands high processing time and basically this stops the processor from doing anything else. And is therefore a very unused factor. This is where interrupts come in handy, An interrupt is raised and thus the processor carries out a new instruction. For example : Consider the case in which you are driving a car , Suddenly another car comes and hits your car.Thus that
acts an interrupt and this raises your car to pull out the balloon and brake.
So, BUT INTERRUPTS are already available in the ATMEGA processors ( AVR ). Turns out you need to solder the rest to obtain a working concept of ARDUINO.
I have honestly never implemented INTERRUPTS in ATMEGA although, IN 2-2 you all will mostly employ interrupts. The KEYBOARD in your laptop! They are basically interrupts from the basic routine the microprocessor undergoes. If it was polling. Each key had to be polled. Imagine THAT!!
So far so good, polling is okhay in arduino as it has a 16Mhz 8 bit processor. Which is fair enough for polling unless you arent doing any high processing code.Which you most likely willnot. Rather get a x86 processor and code it in ASM. ( you will study it in 2-2 once again )
A code for polling :
int getkey()
{ int flag=0,i=0,k=0;
while(!flag)
{ for ( k=0;k<10;k++)
{i+=digitalRead(k);
if(i)
{flag=1;
break;
}
}
}
return k;
}
Someone implement this code and try to observe , how the working is. I didnot get time to check and see myself. Sorry juniors. But, I hope you get the point of what i am trying to convey here. GIVE A DELAY AFTER THIS, OTHERWISE, THE NEXT getkey() WILL TAKE IN THE SAME VALUE, AS a press can be more than 200 clock cycles. If you know what that means! A delay of atleast 2 secs should be taken. REMEMBER THIS IS NOT INTERRUPTS.
QUESTION : MAKE A POV Arduino light. use minimum 6 leds, in a straight line and write a code to make alphabets appear in air, when you move them in a single direction. For help on what i am trying to convey is CHECK HERE
REMEMBER Persistence Of Vision is 1/16th of sec, Which means, if you move any LED a distance under 1/16th of second. It reads as a straight line. > A lot of codes are available out there. Try to come up with your own.! HAVE FUN!!