View previous topic :: View next topic |
Author |
Message |
Logan
Joined: 02 Aug 2011 Posts: 4
|
#int_RDA Function in USB CDC mode |
Posted: Wed Oct 26, 2011 3:28 pm |
|
|
Hello.
I´m working with usb_cdc.h library which emulates a serial COM port on the PC. My question is how to replace the #int_RDA Function used with USART.
EX:
Code: | #int_RDA
void RDA_isr()
{
valor=GETC();
}
void (main): ...
|
The example assigns a value for "valor" when USART reads an incoming character, meanwhile the micro is working on a DO-WHILE task...
Is there any interruption function in USB mode that make the same #int_RDA function?
Last edited by Logan on Wed Oct 26, 2011 3:35 pm; edited 1 time in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Wed Oct 26, 2011 3:34 pm |
|
|
It is already done for you.
USB, is by default entirely interrupt driven. Data is put into a USB data buffer.
Treat kbhit, as a replacement for your buffer not empty check, and the usb_getc, as a replacement for your code to get data from the buffer.
Best Wishes |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Wed Oct 26, 2011 6:06 pm |
|
|
Have a look at the ex_usb_serial.c example program. Been there..done that..and it does work(once you've got the Windows driver(cdc_NTXP.inf) installed.
Also have a look at my '4550 woes' for more helpful hints.
J |
|
|
|