First i must say my english is not that good. So please be nice!
So here is my question. I really don't know how to use the function usbpoll(). Or the other way arround, i don't know how to use it with my problem.
First here is a example code. It just make the LED on and off.
Code: Select all
#define WAIT_TIME 100
....
int main()
{
// LED-Port auf OUT
DDR_LED |= (1 << PAD_LED);
// Timer1 initialisieren
timer1_init();
// Interrupts aktivieren
sei();
// Endlosschleife
// Die LED ist jeweils 1 Sekunde an und 1 Sekunde aus,
// blinkt also mit einer Frequenz von 0.5 Hz
while (1)
{
PORT_LED |= (1 << PAD_LED);
wait_10ms (WAIT_TIME);
PORT_LED &= ~(1 << PAD_LED);
wait_10ms (WAIT_TIME);
}
}
So know i wanna change the "WAIT_TIME" via USB. I modifiy this code to that.
Code: Select all
#define WAIT_TIME 100
....
int main()
{
... USB INIT etc....
while (1)
{
usbpoll();//CHANGE WAIT_TIME and GOES ON
PORT_LED |= (1 << PAD_LED);
wait_10ms (WAIT_TIME);
PORT_LED &= ~(1 << PAD_LED);
wait_10ms (WAIT_TIME);
}
}
}
Will that work?! So the problem is for me does "usbpoll()" only poll, when a interrupt comes or polling everytime, so the it has a effect on the timer of the LED?!
Hope you know what i mean...
So shortly say. Is "usbpoll()" everytime aktiv or only when the host wants an action. Or the otherway arround will any code after "usbpoll()" be called?!
LG Max