hello,
i'm trying to understand how the at89c5131 usb controller works.
I've downloaded the c code examples at atmel site, but there is something i don't get : where are implemented the functions like usb_read_byte, Usb_clear_rx, usb_rx_complete.... ?
I can see they are used a lot, i know what they do, but i can't find them in extenso.
where are implemented the functions like usb_read_byte, Usb_clear_rx, usb_rx_complete.... ?
I can see they are used a lot, i know what they do, but i can't find them in extenso.
Those are not functions. Are macros. You can get them from usb_drv.h header file
Code:
#define Usb_read_byte ( ) ( UEPDATX )
UEPDATX (USB Endpoint X FIFO Data) it's a SFR register at CFh
To read data from an endpoint, select the correct endpoint number in UEPNUM and
read the UEPDATX register. This action automatically decreases the corresponding
address vector, and the next data is then available in the UEPDATX register.
That's exactly what function bellow is doing:
Code:
Uchar* usb_read_packet (Uchar ep_num, Uchar* rbuf, Uchar data_length)
{
Uchar i;
Usb_select_ep(ep_num);
for (i = data_length; i != 0 ; i--, rbuf++)
{ *rbuf = Usb_read_byte(); } // you can write this as *rbuf = UEPDATX;
return rbuf;
}
> i have been going through the same problem....regarding USB CODE for AT89C5131A-L.
> I have established communication between PC and USB. I can read MY microcontrilller's PID no.
>what i need is to tackle/monitor microcontrolller's port pins through my code.
but for that i need USB module to send my data to microcontroller's port.
> can u people help me out sending the USB MODULE or AT89C5131A-L code.
>or otherwise guide me to a proper way to the solution of the problem.