Tonwo222 Guest
|
USB Interrupts with usb.c and 18F4550 |
Posted: Mon Sep 10, 2007 11:20 am |
|
|
Hi.
I want to do a program that add 2 numbers from the PC and return the result. Ive already done this:
void add() {
usb_init();
usb_task();
usb_wait_for_enumeration();
while (TRUE)
{
if(usb_enumerated())
{
if (usb_kbhit(1)) {
usb_get_packet(1, recibe, 2);
resultado = recibe[1] + recibe[0];
usb_put_packet(1, resultado, 1, USB_DTS_TOGGLE); }
}
}
}
And works fine.
Now i need to do with interrupts, like this:
#int_usb
void add() ...
But the driver usb.c controls the interrupts, how can i do it? I need to change something in the usb.c but i dont know why.
Anybody could help me? Is there any other way easier?
Thanks a lot and sorry for my English. |
|