欢迎访问ic37.com |
会员登录 免费注册
发布采购

PIC16C745-I/SO 参数 Datasheet PDF下载

PIC16C745-I/SO图片预览
型号: PIC16C745-I/SO
PDF下载: 下载PDF文件 查看货源
内容描述: IC- 8-BIT MCU\n [IC-8-BIT MCU ]
分类和应用: 微控制器和处理器外围集成电路光电二极管PC可编程只读存储器时钟
文件页数/大小: 158 页 / 2499 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号PIC16C745-I/SO的Datasheet PDF文件第69页浏览型号PIC16C745-I/SO的Datasheet PDF文件第70页浏览型号PIC16C745-I/SO的Datasheet PDF文件第71页浏览型号PIC16C745-I/SO的Datasheet PDF文件第72页浏览型号PIC16C745-I/SO的Datasheet PDF文件第74页浏览型号PIC16C745-I/SO的Datasheet PDF文件第75页浏览型号PIC16C745-I/SO的Datasheet PDF文件第76页浏览型号PIC16C745-I/SO的Datasheet PDF文件第77页  
PIC16C745/765  
SET_CONFIGURATION command. Once the device  
is configured, the application can communicate with  
the host using the GetUSB and PutUSB calls.  
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.  
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.  
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  
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.  
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  
CheckEP1  
call  
CheckSleep  
; Ok, here’s a good point to put part to sleep if no activity on the bus.  
; Check Endpoint 1 for an OUT transaction  
; point to lower banks  
bcf  
STATUS,IRP  
buffer  
FSR  
movlw  
movwf  
movlw  
call  
btfss  
goto  
; point FSR to our buffer  
; check end point 1  
; If data is ready, it will be copied.  
; was there any data for us?  
; Nope, check again.  
1
GetUSB  
STATUS,C  
idleloop  
PutBuffer  
bcf  
STATUS,IRP  
bufferlen  
buffer  
FSR  
bufferlen,w  
1
; point to lower banks  
; save buffer length  
movwf  
movlw  
movwf  
swapf  
iorlw  
call  
; point FSR to our buffer  
; upper nybble of W is buffer length  
; lower nybble of W is EndPoint number  
PutUSB  
btfss  
goto  
goto  
STATUS,C  
PutBuffer  
idleloop  
; was it successful?  
; No: try again until successful  
; Yes: restart loop  
end  
1999 Microchip Technology Inc.  
Advanced Information  
DS41124A-page 73  
 复制成功!