Choose and copy the generated code

… visits
Parent Previous Next

For a new program, copy Integration once. For an existing program, use it as a guide to merge the settings and service code carefully. This page explains which tab to use and what to check before compiling.

Open the tab for your USB type

Tab

Configure here

Continue with

HID

Report profile, usage identifiers, feature report and optional custom report descriptor

HID guide

CDC

Initial serial line settings, protocol description, notification interval and optional DTR requirement

CDC guide

MSC

Drive label and each fixed file's name, length and write permission

MSC guide

Network

Address subnet, unit identifier, published values, browser input slots and page layout

Browser guide

All integer options from 1 through 8 are available for MSC file count. Named browser values and browser input slots offer every count from 1 through 16, with a separate zero option for their documented meanings. Firmware page count offers every count from 1 through 8.

Choose the right output tab

Output tab

What it contains

Use it when

Defines

The library's selected $define settings and Include "USB_Device.inc"

Adding USB settings to a program that already has a controlled startup structure

Integration

A starting listing with target, clock, fuses, defines, startup, servicing and applicable inline page tables

Creating a new program or checking the correct order of initialization

ISR

The generated interrupt arrangement and relevant guidance

Integrating USB into an existing interrupt structure

Summary

Selected behavior, memory estimates and device-specific notes

Checking that the configuration matches your intention

Web include

Inline BASIC page tables for firmware pages, or HTML text for external-page mode

Supplying or replacing the browser interface

Select the desired output and press Copy tab. No separate export step is required. The tool does not create companion web include files. For custom firmware pages, the tables go into the main BASIC listing after the stack include; complete Integration output already contains them. The built-in page needs no additional page table. For external-page mode, save the displayed HTML yourself as a local .html file.

Add USB to a program you already have

  1. Save a copy of your working application.
  2. Generate a configuration for the exact same device and board clock.
  3. Compare the generated fuse and runtime setup with your existing setup. Resolve differences deliberately; do not leave two contradictory clock sequences.
  4. Add the USB definitions and include once, before USB initialization and, on PIC18 or PIC16, before application variable allocation.
  5. Add the generated USB startup at the appropriate point after board/clock setup.
  6. Merge the USB ISR into your existing interrupt structure if interrupt servicing is selected. Keep the context protection and the other interrupt sources' handlers.
  7. Add the class's foreground service and data handling.
  8. Compile, check memory and repeat the small communication test before enabling the rest of the application.

Do not use a blanket Clear after USB starts. It can erase the library's working data too. Initialize your buffers first, or clear only the particular application variables you need to reset.

Fix errors and read the notes

An error means the selected values cannot produce a supported configuration. Typical causes include a report length inconsistent with its profile, an unsupported class on that target, an invalid clock combination or insufficient memory. Correct the input rather than copying partly generated output.

Network custom-page setup with two configuration errors, no imported HTML, Copy tab disabled, and Configuration needs attention shown at the bottom.

This is an unfinished setup, not a working example. Two custom pages are enabled but their HTML is missing. Select each page, import its HTML, then check that the errors clear before copying the code.

A note provides information that still needs your attention, such as an example VID/PID, a device-specific silicon restriction or the need to check compiler RAM usage. Read it in the context of your selected device and board. Successful configuration validation checks the tool's settings; it cannot check the actual crystal, wiring, programmed fuse values or application timing on your board.

See also

Created with the Personal Edition of HelpNDoc: Elevate Your Documentation with HelpNDoc's Project Analyzer Features