PIC16C765 Microchip Technology Inc., PIC16C765 Datasheet - Page 74

no-image

PIC16C765

Manufacturer Part Number
PIC16C765
Description
8-bit Cmos Microcontrollers With Usb
Manufacturer
Microchip Technology Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC16C765-I/L
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
PIC16C765-I/P
Manufacturer:
MICROCHIP
Quantity:
12 000
Part Number:
PIC16C765-I/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
PIC16C765/JW
Manufacturer:
MIC
Quantity:
60
Part Number:
PIC16C765/JW
Manufacturer:
MIC
Quantity:
60
Part Number:
PIC16C765/JW
Manufacturer:
MIC
Quantity:
5
Part Number:
PIC16C765/JW
Manufacturer:
MICROCH
Quantity:
20 000
Part Number:
PIC16C765T-I/L
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
PIC16C765T-I/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
PIC16C745/765
ConfiguredUSB (Macro) continuously polls the enu-
meration status bits and waits until the device has been
configured by the host. This should be used after the
call to InitUSB and prior to the first time your application
attempts to communicate on the bus.
SetConfiguration is a callback function that allows
your application to associate some meaning to a Set
Configuration command from the host. The CH9 soft-
ware stores the value in USB_Curr_Config so it can be
reported back on a Get Configuration call. This func-
tion is also called, passing the new configuration in W.
This function is called from within the ISR, so it should
be kept as short as possible.
10.9.6
InitUSB clears the error counters and enables the
3.3V regulator and the USB Reset interrupt. This
implements the requirement to prevent the PICmicro
device from responding to commands until the device
has been RESET.
The host sees the device and resets the device, to
begin the enumeration process. The RESET then ini-
tializes the Buffer Descriptor Table (BDT), EndPoint
Control Registers and enables the remaining USB
interrupt sources.
The Interrupt transfers control to the interrupt vector
(address
must preserve the processor state by saving the FSRs
that might change during interrupt processing. We rec-
ommend saving W, STATUS, PCLATH and FSR. W
can be stored in unbanked RAM to avoid banking
issues. Then it starts polling the Interrupt flags to see
what triggered the interrupt. The USB interrupts are
serviced by calling ServiceUSBInt which further tests
the USB interrupt sources to determine how to pro-
cess the interrupt.
Then, the host sends a setup token requesting the
device descriptor. The USB Peripheral receives the
Setup transaction, places the data portion in the EP0
OUT buffer, loads the USTAT register to indicate which
endpoint received the data and triggers the Token
Done (TOK_DNE) interrupt. The Chapter 9 commands
then interpret the Setup token and sets up the data to
respond to the request in the EP0 IN buffer, then sets
the UOWN bit to tell the SIE there is data available.
DS41124C-page 74
BEHIND THE SCENES
0x0004). Any Interrupt Service Routine
Preliminary
Then, the host sends an IN transaction to receive the
data from the setup transaction. The SIE sends the
data from the EP0 IN buffer and then sets the Token
Done interrupt to notify us that the data has been sent.
If there is additional data, the next buffer is setup in
EP0 IN buffer.
This token processing sequence holds true for the
entire enumeration sequence, which walks through the
flow chart starting chapter 9 of the USB spec. The
device starts off in the powered state, transitions to
default
ADDRESSED via the SetAddress command, and
transitions to CONFIGURED via a SetConfiguration
command.
The USB peripheral detects several different errors
and handles most internally. The USB_ERR interrupt
notifies the PICmicro device that an error has
occurred. No action is required by the device when an
error occurs. Instead, the errors are simply acknowl-
edged 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 pro-
cessing may continue.
CheckSleep is a separate call that takes the bus idle
one step further and puts the PICmicro device to
SLEEP, if the USB peripheral has detected no activity
on the bus. This powers down most of the device to
minimal current draw. This call should be made at a
point in the main loop where all other processing is
complete.
via
the
Reset
2000 Microchip Technology Inc.
interrupt,
transitions
to

Related parts for PIC16C765