PIC16C745/P Microchip Technology, PIC16C745/P Datasheet - Page 71

no-image

PIC16C745/P

Manufacturer Part Number
PIC16C745/P
Description
8-Bit CMOS Microcontrollers with USB
Manufacturer
Microchip Technology
Datasheet
10.9
10.9.1
Microchip provides a layer of software that handles the
lowest level interface so your application won’t have to.
This provides a simple Put/Get interface for communi-
cation. Most of the USB processing takes place in the
background through the Interrupt Service Routine.
From the application viewpoint, the enumeration pro-
cess and data communication takes place without fur-
ther interaction.
FIGURE 10-2: USB SOFTWARE INTERFACE
10.9.2
The latest version of the USB interface software is
available on Microchip Technology’s website. See
http://www.microchip.com/
Communicating on USB is similar to communicating
via a hardware USART. The main difference is that a
USART typically works on a single byte at a time,
where USB operates on a buffer of up to 8 bytes at a
time.
There is one function defined to start the enumeration
process and two additional functions are defined for
moving buffers between the main application and the
USB peripheral. InitUSB initializes the USB peripheral
allowing the host to enumerate the device. Then for
normal data communications, function PutUSB sends
data to the host and function GetUSB receives data
from the host.
There's a lot that happens behind the scenes to make
the communication work, but these calls are all an
application needs to communicate on the bus. The
rest is handled on an interrupt basis.
InitUSB initializes the Buffer Descriptor table, and
enables the USB interrupt so enumeration can begin.
The actual enumeration process occurs automatically,
driven by the host and interrupt service routine. The
macro ConfiguredUSB waits until the device is in the
CONFIGURED mode and ready to go.
required to enumerate is completely dependent on the
host and bus loading.
1999 Microchip Technology Inc.
USB Firmware Users Guide
INTRODUCING THE USB SOFTWARE
INTERFACE
INTEGRATING USB INTO YOUR
APPLICATION
Put
Main Application
USB Peripheral
Get
Init
Advanced Information
USB
The time
10.9.3
10.9.3.1
Most of the USB processing occurs via the interrupt
and thus is invisible to application. However it still con-
sumes processor resources.
RAM, Common RAM, Stack Levels and processor
cycles. This section attempts to quantify the impact on
each of these resources, and shows ways to avoid
conflicts.
These are the considerations you'll need to take into
account if you write your own Interrupt Service Rou-
tine: Save W, Status, FSR and PCLATH which are the
file registers that may be corrupted by servicing the
USB interrupt.
and includes tests for each of the possible ISR bits.
This provides a good place to start from if you haven't
already written your own. See file USB_INT.ASM.
10.9.3.2
The hardware stack on the device is only 8 levels
deep. So the worst case call between the application
and ISR can only be 8 levels. The enumeration pro-
cess requires 6 levels, so it's best if the main applica-
tion holds off on any processing until enumeration is
complete. ConfiguredUSB is a macro that waits until
the enumeration process is complete for exactly this
purpose.
10.9.3.3
The code required to support the USB interrupt,
including the chapter 9 interface calls, but not including
the descriptor tables is about 1kW. The descriptor and
string descriptor tables can each take up to an addi-
tional 256W.
restricted, and the linker script may be edited to control
the placement of each part.
Descriptors sections in the linker script
10.9.3.4
With the exception of Common RAM discussed below,
servicing the USB interrupt costs ~40 bytes of RAM in
Bank 2. That leaves all the General Purpose RAM in
banks zero and one, plus half of bank two available for
your application to use.
10.9.3.5
The PIC16C745/765 has 16 bytes of common RAM.
These are the last 16 addresses in each bank and all
refer to the same 16 bytes of memory without regard
to which register bank is currently addressed by the
RP0 and RP1 bits.
These are particularly useful when responding to inter-
rupts.
immediately know which bank is addressed.
devices that don't support common RAM, the W regis-
We provide a skeleton ISR which will do this for you,
When an interrupt occurs, the ISR doesn't
INTERRUPT STRUCTURE CONCERNS
Processor Resources
Stack Levels
ROM
RAM
Common RAM usage
PIC16C745/765
The location of these parts is not
These include ROM,
See the Strings and
DS41124A-page 71
With

Related parts for PIC16C745/P