| поискавой системы для электроныых деталей |
|
PIC16C745/P датащи(PDF) 73 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC16C745/P датащи(HTML) 73 Page - Microchip Technology |
|
73 / 158 page ![]() © 1999 Microchip Technology Inc. Advanced Information DS41124A-page 73 PIC16C745/765 SET_CONFIGURATION command. Once the device is configured, the application can communicate with the host using the GetUSB and PutUSB calls. The USB peripheral detects several different errors and handles most internally. The USB_ERR interrupt notifies the microcontroller that an error has occurred. No action is required by the device when an error occurs. Instead the errors are simply acknowledged and counted. There is no mechanism to pull the device off the bus if there are too many errors. If this behavior is desired it must be implemented in the application. The Activity interrupt is left disabled until the USB peripheral detects no bus activity for 3 mS. Then it suspends the USB peripheral and enables the activity interrupt. The activity interrupt then reactivates the USB peripheral when bus activity resumes so process- ing may continue. CheckSleep is a separate call that takes the bus idle one step further and puts the device to sleep if the USB peripheral has detected no activity on the bus. This powers down most of the device to minimal cur- rent draw. This call should be made at a point in the main loop where all other processing is complete. 10.9.6 EXAMPLES This example shows how the USB functions are used. This example first initializes the USB peripheral which allows the host to enumerate the device. The enumer- ation process occurs in the background, via an Inter- rupt service routine. This function waits until enumeration is complete, and then polls EP1 OUT to see if there is any data available. When a buffer is available, it is copied to the IN buffer. Presumably your application would do something more interesting with the data than this example. ; ****************************************************************** ; Demo program that initializes the USB peripheral, allows the Host ; to Enumerate, then copies buffers from EP1OUT to EP1IN. ; ****************************************************************** main call InitUSB ; Set up everything so we can enumerate ConfiguredUSB ; wait here until we have enumerated. idleloop call CheckSleep ; Ok, here’s a good point to put part to sleep if no activity on the bus. CheckEP1 ; Check Endpoint 1 for an OUT transaction bcf STATUS,IRP ; point to lower banks movlw buffer movwf FSR ; point FSR to our buffer movlw 1 ; check end point 1 call GetUSB ; If data is ready, it will be copied. btfss STATUS,C ; was there any data for us? goto idleloop ; Nope, check again. PutBuffer bcf STATUS,IRP ; point to lower banks movwf bufferlen ; save buffer length movlw buffer movwf FSR ; point FSR to our buffer swapf bufferlen,w ; upper nybble of W is buffer length iorlw 1 ; lower nybble of W is EndPoint number call PutUSB btfss STATUS,C ; was it successful? goto PutBuffer ; No: try again until successful goto idleloop ; Yes: restart loop end |
|
ссылки URL |
| Вашему бизинису помогли Аллдатащит? [ DONATE ] |
Что такое Аллдатащит | реклама | контакт | Конфиденциальность | Ссылка на техническое описание | обмен ссыками | поиск по производителю All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |