欢迎访问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文件第68页浏览型号PIC16C745-I/SO的Datasheet PDF文件第69页浏览型号PIC16C745-I/SO的Datasheet PDF文件第70页浏览型号PIC16C745-I/SO的Datasheet PDF文件第71页浏览型号PIC16C745-I/SO的Datasheet PDF文件第73页浏览型号PIC16C745-I/SO的Datasheet PDF文件第74页浏览型号PIC16C745-I/SO的Datasheet PDF文件第75页浏览型号PIC16C745-I/SO的Datasheet PDF文件第76页  
PIC16C745/765  
ter must be provided for in each bank. The 16C745/  
765 can save the appropriate registers in Common  
RAM and not have to waste a byte in each bank for W  
register.  
GetUSB (Buffer Pointer, Endpoint) returns data sent  
from the host. If there is a buffer ready (i.e., data has  
been received from the host) it is copied to the desti-  
nation pointed to by FSR/IRP (A buffer pointer in FSF/  
IRP and the endpoint number in W must be provided.).  
If no data is available, it returns a failure code. Thus,  
the functions of polling for buffer ready and copying the  
data are combined into the one function.  
10.9.3.6 Buffer allocation  
The PIC16C745/765 has 64 bytes of Dual Port RAM.  
24 are used for the Buffer Descriptor Table (BDT) leav-  
ing 40 bytes for buffers.  
ServiceUSBInt handles all interrupts generated by the  
USB peripheral. First it copies the active buffer to  
common RAM which provides a quick turn around on  
the buffer in dual port RAM and also to avoids having  
to switch banks during processing of the buffer.  
Endpoint 0 IN and OUT need dedicated buffers since a  
setup transaction can never be NAKed. That leaves  
three buffers for four possible Endpoints. But the USB  
spec requires that low speed devices are only allowed  
2 endpoints (USB 1.1 paragraph 5.3.1.2), where an  
endpoint is a simplex connection that defined by the  
combination of Endpoint number and direction.  
StallUSBEP/UnstallUSBEP sets or clears the stall bit  
in the endpoint control register. The stall bit indicates  
to the host that user intervention is required and until  
such intervention is made, further attempts to commu-  
nicate with the endpoint will not be successful. Once  
the user intervention has been made, UnstallUSBEP  
will clear the bit allowing communications to take  
place. These calls are useful to signal to the host that  
user intervention is required. An example of this might  
be a printer out of paper.  
The default configuration allocates individual buffers to  
EP0 OUT, EP0 In, EP1 Out, and EP1 In. The last  
buffer is shared between EP2 In and EP2 Out. Again,  
the spec says low speed devices can only use 2 end-  
points beyond EP0. This configuration supports most  
of the possible combinations of endpoints (EP1 OUT  
and EP1 IN, EP1OUT and EP2IN, EP1 OUT and EP2  
OUT, EP1 IN and EP2 OUT, EP1 IN and EP2 IN). The  
only combination that is not supported by this configu-  
ration is Endpoint 2 IN and Endpoint 2 OUT. If your  
application needs both EP2 IN and EP2 OUT, the func-  
tion USBReset will need to be edited to give each of  
these dedicated buffers at the expense of EP1.  
CheckSleep Tests the UCTRL.UIDLE bit if set, indi-  
cating that there has been no activity on the bus for 3  
mS, puts the device to sleep. This puts the part into a  
low power standby mode until awakened by bus activ-  
ity. This has to be handled outside the ISR because we  
need the interrupt to wake us from sleep, and also  
because the application may not be ready to sleep  
when the interrupt occurs. Instead, the application  
should periodically call this function to poll the bit when  
the device is in a good place to sleep.  
10.9.4 FUNCTION CALL REFERENCE  
Interface between the Application and Protocol layer  
takes place in three main functions: InitUSB, PutUSB  
and GetUSB.  
Prior to putting the device to sleep, it enables the activ-  
ity interrupt so the device will be awakened by the first  
transition on the bus. The device will immediately  
jump to the ISR, recognizing the activity interrupt,  
which then disables the interrupt and resumes pro-  
cessing with the instruction following the CheckSleep  
call.  
InitUSB should be called by the main program imme-  
diately upon power-up. It sets up the Buffer Descriptor  
Table, transitions the part to the Powered state, and  
prepares the device for enumeration. At this point the  
USB Reset is the only USB interrupt allowed, prevent-  
ing the part from responding to anything on the bus  
until it’s been reset. The USB Reset interrupt transi-  
tions the part to the default state where it responds to  
commands on address zero. When it receives a SET  
ADDRESS command, the device transitions to the  
addressed state and now responds to commands on  
the new address.  
ConfiguredUSB (Macro) Continuously polls the enu-  
meration status bits and waits until the device has  
been configured by the host.  
10.9.5 BEHIND THE SCENES  
The ISR calls ServiceUSBInt, which then further has  
to mask the USB Interrupt register with the USB Inter-  
rupt Enable bits, then see what caused the interrupt.  
InitUSB only enables the Reset interrupt (USB_RST).  
This prevents the device from responding to anything  
on the bus until it’s been reset by the host. When the  
reset is received, the Buffer Descriptors are initialized,  
most of the rest of the interrupts are unmasked and  
the device transitions from the POWERED to  
DEFAULT state. Now it can respond to commands on  
address zero. From there the rest of the enumeration  
process takes place, including assigning an address to  
the device through the SET_ADDRESS command and  
PutUSB (Buffer pointer, Buffer size, Endpoint) sends  
data up to the host. The pointer to the block of data to  
transmit, is in the FSR/IRP, and the block size and  
endpoint is passed in W register. If the IN buffer is  
available for that endpoint, the block of data is copied  
to the buffer, then the Data 0/1 bit is flipped and the  
owns bit is set. A buffer not available would occur  
when it has been previously loaded and the host has  
not requested that the USB peripheral transmit it. In  
this case, a failure code would be returned so the  
application can try again later.  
selecting  
a
configuration  
through  
the  
DS41124A-page 72  
Advanced Information  
1999 Microchip Technology Inc.  
 复制成功!