Copy, compile and program the PIC

… visits
Parent Previous Next

The Integration tab is the best starting point for a new project. Copy it as a complete program before adding your own features. The code examples elsewhere in this manual are smaller pieces, not replacements for the generated board setup.

Integration output showing the PIC selection, Declare Xtal, and configuration fuses, with Copy tab at the top.

For a new program, open Integration and use Copy tab. Copy the complete listing, not just the lines visible in the picture.

Starting with Framework?

If you are using a working example from Framework, keep its startup code together and check its PIC and clock settings. The steps below explain the alternative of starting from the tool's complete Integration listing. Do not paste two complete startup programs into one file. See the supplied folders.

Copy, compile and program

Open Integration, press Copy tab, and paste the result into a new .bas file. Use this complete starting program. It keeps the PIC choice, clock, configuration fuses, USB settings and startup in the right order.

  1. Save the BASIC file in your project directory.
  2. Check that its Include "USB_Device.inc" resolves to the intended library file.
  3. Read the comments marking application code and board-specific work.
  4. Add only a small test action first: echo one HID/CDC command, return a fixed file, or publish a constant browser value.
  5. Compile using the Positron compiler for that PIC.
  6. Check program-memory and RAM usage, including compiler temporaries and interrupt context.
  7. Program both the firmware and its intended configuration words.

Copy Integration once. It already contains the needed Defines, ISR and page tables. Pasting those tabs into it again creates duplicate code.

Keep the include order. On PIC18 and PIC16, put the USB include before your own variable declarations and before other includes that allocate variables. This reserves the USB memory safely. On PIC16 the USB descriptor table must be at the start of RAM. Use the application-declaration position shown in the generated program.

See also

Created with the Personal Edition of HelpNDoc: Full-featured multi-format Help generator