Pololu P-Star Series User manual

Pololu P-Star User’s Guide
1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Supported operating systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Contacting Pololu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3. P-Star 25K50 Micro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1. P-Star 25K50 Micro pinout and components . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2. P-Star 25K50 Micro schematic and dimensions . . . . . . . . . . . . . . . . . . . . . . . 8
4. P-Star 45K50 Mini SV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.1. P-Star 45K50 Mini SV pinout and components . . . . . . . . . . . . . . . . . . . . . . 11
4.2. P-Star 45K50 Mini SV schematic and dimensions . . . . . . . . . . . . . . . . . . . . 15
5. etting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1. Installing p-load and drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.2. etting into bootloader mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.3. Compiling a program with MPLAB X and XC8 . . . . . . . . . . . . . . . . . . . . . . 19
5.4. Programming using p-load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6. The P-Star Bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.1. Memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.2. Startup procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.3. Bootloader I/O pin usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.4. Bootloader LED behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.5. Configuration bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
7. Programming using the PICkit 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
8. Compiling P-Star examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
9. Compiling a USB application with M-Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
10. Compiling a program with MPLAB X and MPASM . . . . . . . . . . . . . . . . . . . . . . . 39
11. Compiling a program with PICBASIC PRO . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
https://www.pololu.com/docs/0J62/all Page 1 of 46

P-Star 25K50 Micro (top) and P-Star
45K50 Mini SV (bottom).
1. Overview
The Pololu P-Star microcontroller boards are a family of
general-purpose programmable modules based on the
PIC18F25K50 and PIC18F45K50 microcontrollers from
Microchip, which have 32 KB of flash program memory,
2 KB of RAM, and built-in full-speed USB functionality.
The P-Stars add on-board components and connectors
that support the microcontroller and make it easier to
use. Each board ships with a USB bootloader that makes
it easy to load new programs without using an external
programmer.
The P-Star requires a USB A to Micro-B cable [https://www.pololu.com/product/2072] (not
included) to connect to a computer.
Features and specifications
• Programmable Microchip PIC18F25K50 or PIC18F45K50 microcontroller
◦ 32 KB flash (8 KB used by bootloader, leaving 24 KB available for user program by
default)
◦ 2 KB SRAM
◦ 256 bytes of EEPROM
◦ Native full-speed USB (12 Mbps)
◦ 2 PWM output signals (one of which can be sent to four different pins)
◦ 5-bit digital-to-analog converter (DAC) output
• 5 V logic voltage
• Internally clocked at 48 MHz, resulting in execution speeds up to 12 million instructions per
second (MIPS)
• Precision 16 MHz crystal
• Three user-controllable LEDs
• USB Micro-B connector
• Can be powered from USB or external source regulated to 5 V by on-board regulator
• Reverse-voltage protection on external power input
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
1. Overview Page 2 of 46

• Ships with a proprietary USB bootloader developed by Pololu for the P-Star (see Section 6)
• Bootloader is usable from Windows, Linux, and Mac OS X with open source software
[https://github.com/pololu/p-load]
• No external programmer required
• Compatible with standard Microchip compilers, development tools, and programmers
P-Star comparison table
P-Star 25K50 Micro P-Star 45K50 Mini SV
Microcontroller: PIC18F25K50 PIC18F45K50
User I/O lines: 19 30
Analog inputs: 14 25
Reset button:
Operating voltage: 5.5 V to 15 V 5 V to 36 V
Regulator type: l near sw tch ng step-down
Regulated current:(1) 100 mA 500 mA
Auxiliary 3.3 V regulator:
Dimensions: 1″ × 0.6″ 2.0″ × 0.7″
Weight:(2) 1.3 g 3.5 g
1These values are rough approx mat ons for compar son purposes. Ava lable current depends on nput voltage,
current consumed by the board, amb ent cond t ons, and regulator topology.
2W thout ncluded opt onal headers.
1.1. Supported operating systems
The Pololu USB Bootloader Utility (p-load), which is used to load programs onto the P-Star, works on
Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Linux, and macOS. The utility
does not work on Windows XP. The source code [https://github.com/pololu/p-load] is available, so it
should be possible to port it to more operating systems.
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
1. Overview Page 3 of 46

2. Contacting Pololu
We would be delighted to hear from you about any of your
projects and about your experience with the P-Star. You can
contact us [https://www.pololu.com/contact] directly or post on our
forum [http://forum.pololu.com/]. Tell us what we did well, what we
could improve, what you would like to see in the future, or
anything else you would like to say!
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
2. Contacting Pololu Page 4 of 46

3. P-Star 25K50 Micro
P-Star 25K50
Micro, top view.
3.1. P-Star 25K50 Micro pinout and components
P-Star 25K50 Micro pinout diagram.
This diagram identifies the I/O and power pins on the P-Star 25K50 Micro. The diagram is also
available as a printable PDF [https://www.pololu.com/file/0J799/p-star-25K50-micro-pinout.pdf] (161k pdf).
For more information about the PIC18F25K50 microcontroller and its peripherals, see Microchip’s
PIC18F25K50 documentation [http://www.microchip.com/PIC18F25K50].
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
3. P-Star 25K50 Micro Page 5 of 46

LEDs
The P-Star 25K50 Micro has three indicator LEDs. These LEDs are connected in the same way on all
P-Stars.
The yellow LED is connected to RB6. Driving this pin high turns on the LED. In bootloader mode, the
bootloader drives this line high to turn on the LED (see Section 6.4) but never drives it low. If this line
is high when the microcontroller starts up, the microcontroller will go into bootloader mode. A button
can be connected to RB6 as described in Section 5.2. RB6 has an on-board pull-down resistor to
ensure that its voltage goes all the way down to 0 V when not being driven.
The green LED is connected to RB7, and lights when the pin is driven high. In bootloader mode, the
bootloader drives this line high to turn on the LED (see Section 6.4) but never drives it low.
The red LED is connected to RC6, and lights when the pin is driven low. RC6 is the microcontroller’s
serial TX line, so the red LED serves as an indicator for when the board is transmitting serial data. If
you are not using serial, the LED can be used as a normal LED. To avoid interference with connected
serial devices, the bootloader does not use this LED.
Connectors
The P-Star includes a USB Micro-B connector that can be used to connect to a computer’s USB port
via a USB A to Micro-B cable [https://www.pololu.com/product/2072] (not included). The USB connection
can be used to transmit and receive data from the computer, and a preloaded USB bootloader makes
it possible to program the board over USB. The USB connection can also provide power to the P-Star.
The board also has five pins arranged so that they can be directly plugged into a standard In-Circuit
Serial Programming (ICSP) connector, such as the one found on the PICkit 3. More information about
programming with the PICkit 3 can be found in Section 7. The five pins are: MCLR, VDD, ND, RB7/
P D, and RB6/P C. The MCLR pin is pin 1.
Power
The P-Star 25K50 Micro can either be powered directly from the USB 5 V supply or from a separate
source on the VI pin. The board features a power selection circuit that allows both USB and VIN to
be connected at the same time; if this is done, the P-Star will draw power from VIN.
USB power input: The P-Star can be powered from the USB 5 V bus voltage (VBUS) if it is connected
to a USB cable. It will draw power from USB only if VIN is disconnected. A resettable PTC fuse on
VBUS makes it less likely for the P-Star (and the connected computer or other device) to be damaged
if too much current is drawn from the USB connection.
VI power input: The P-Star can be powered from VIN if you connect a 5.5 V to 15 V power
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
3. P-Star 25K50 Micro Page 6 of 46

supply (such as a battery or wall power adapter) to the VIN and ND pins, with the positive terminal
connected to VIN.
VDD: This pin provides access to the board’s 5 V supply, which comes from either the USB 5 V bus
voltage or a low-dropout (LDO) regulator on VIN, depending on which power source is connected. The
regulator can supply up to 100 mA, although some of this is used by the board itself or used to provide
current for the PIO pins.
To ensure that VDD is a stable 5 V, you must either disconnect VIN and use USB to power the board or
supply a VIN of at least 5.5 V. When VIN drops below 5.5 V, VDD will fall (even with USB connected).
However, the P-Star will continue to run with VDD below 5 V, and it can operate from VIN alone with
VIN as low as 3.2 V to 3.8 V, depending on the load and temperature. With USB connected, VDD will
drop at worst to about 4.5 V, and the P-star will continue operating no matter how low VIN is.
When the P-Star 25K50 Micro is being powered through VIN, regardless of whether USB is connected,
the sum of the 5V output current, PIO output current, and current used by the board itself (typically
about 18 mA) should not exceed the 100 mA that the regulator can provide.
P-Star 25K50 Micro, bottom view. P-Star 25K50 with U.S. quarter for size
reference.
USB power sensing
The VB pin, located on the interior of the board, is connected to the USB 5 V bus voltage through a
1 kΩ resistor. By default, the VB pin is also connected to the RA0 pin through a cuttable trace on the
bottom of the board between the two pins. This means that RA0 can be used as a digital or analog
input to detect the presence of USB power. Cutting the trace between the VB and RA0 pins allows
RA0 to be used for other purposes.
Crystal
The P-Star 25K50 Micro has a precision 16 MHz crystal. By default, this crystal is used to provide a
clock signal for the microcontroller and its peripherals.
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
3. P-Star 25K50 Micro Page 7 of 46

Included hardware
Two 1×10-pin breakaway 0.1″ male headers [https://www.pololu.com/product/965] and one 1×6-pin
breakaway 0.1″ male header are included with the P-Star 25K50 Micro. These header pins can be
soldered in to use the board with perfboards, breadboards [https://www.pololu.com/category/28/solderless-
breadboards], or 0.1″ female connectors [https://www.pololu.com/category/50/0.1-2.54-mm-female-headers].
P-Star 25K50 Micro with included
optional headers.
The P-Star 25K50 Micro with soldered
headers and connected USB cable.
3.2. P-Star 25K50 Micro schematic and dimensions
Schematic diagram
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
3. P-Star 25K50 Micro Page 8 of 46

[https://www.pololu.com/file/0J797/p-star-25K50-micro-schematic.pdf] (414k pdf).
Dimension diagram
A dimension diagram is available as a PDF: P-Star 25K50 Micro dimension diagram
[https://www.pololu.com/file/0J798/p-star-25K50-micro-dimensions.pdf] (202k pdf)
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
3. P-Star 25K50 Micro Page 10 of 46

This diagram identifies the I/O and power pins on the P-Star 45K50 Mini. The diagram is also
available as a printable PDF [https://www.pololu.com/file/0J1384/p-star_45k50_mini_sv_pinout.pdf] (547k pdf).
For more information about the PIC18F45K50 microcontroller and its peripherals, see Microchip’s
PIC18F45K50 documentation [http://www.microchip.com/PIC18F45K50].
LEDs
The P-Star 45K50 Mini has three indicator LEDs. These LEDs are connected in the same way on all
P-Stars.
The yellow LED is connected to RB6. Driving this pin high turns on the LED. In bootloader mode, the
bootloader drives this line high to turn on the LED (see Section 6.4) but never drives it low. If this line
is high when the microcontroller starts up, the microcontroller will go into bootloader mode. A button
can be connected to RB6 as described in Section 5.2. RB6 has an on-board pull-down resistor to
ensure that its voltage goes all the way down to 0 V when not being driven.
The green LED is connected to RB7, and lights when the pin is driven high. In bootloader mode, the
bootloader drives this line high to turn on the LED (see Section 6.4) but never drives it low.
The red LED is connected to RC6, and lights when the pin is driven low. RC6 is the microcontroller’s
serial TX line, so the red LED serves as an indicator for when the board is transmitting serial data. If
you are not using serial, the LED can be used as a normal LED. To avoid interference with connected
serial devices, the bootloader does not use this LED.
Connectors
The P-Star includes a USB Micro-B connector that can be used to connect to a computer’s USB port
via a USB A to Micro-B cable [https://www.pololu.com/product/2072] (not included). The USB connection
can be used to transmit and receive data from the computer, and a preloaded USB bootloader makes
it possible to program the board over USB. The USB connection can also provide power to the P-Star.
The board also has five pins arranged so that they can be directly plugged into a standard In-Circuit
Serial Programming (ICSP) connector, such as the one found on the PICkit 3. More information about
programming with the PICkit 3 can be found in Section 7. The five pins are: MCLR, VDD, ND, RB7/
P D, and RB6/P C. The MCLR pin is pin 1.
Power
The P-Star 45K50 Mini SV can either be powered directly from the USB 5 V supply or from an external
voltage source between 5 V and 36 V, which is regulated to 5 V by a 500 mA ISL85415 switching step-
down (buck) converter from Intersil. (We also make a standalone regulator [https://www.pololu.com/
product/2843] based on this integrated circuit.). The board also has an auxiliary linear regulator
producing 3.3 V.
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
4. P-Star 45K50 Mini SV Page 12 of 46

The board’s power selection circuit uses the TPS2113A power multiplexer [https://www.pololu.com/
product/2596] from Texas Instruments to choose whether its 5 V supply is sourced from USB or an
external supply via the regulator, allowing both sources to be connected at the same time and enabling
the P-Star to safely and seamlessly transition between them. The TPS2113A is configured to select
external power unless the regulator output falls below about 4.5 V. If this happens, it will select the
higher of the two sources, which will typically be the USB 5 V bus voltage if the P-Star is connected
to USB. The currently selected source is indicated by the STAT pin in the middle of the board; this pin
is an open-drain output that is low if the external power source is selected and high-impedance if the
USB supply is selected. The current limit of the TPS2113A is set to about 1.9 A. For more information
about the power multiplexer, see the TPS2113A datasheet [https://www.pololu.com/file/0J771/tps2113a.pdf]
(1MB pdf).
In some situations, it might be undesirable for the P-Star 45K50 Mini to draw power from an external
source when it is connected to USB. If this is the case, the regulator can be disabled by driving the
regulator shutdown pin, SHD , high; this shuts down the regulator and causes the power mux to fall
back to USB power. For example, this could allow a battery-powered device to turn off the regulator
and avoid draining its battery while it is connected to a computer.
USB power input: The P-Star can be powered from the USB 5 V bus voltage (VBUS) if it is connected
to a USB cable. It will draw power from USB only if its external voltage source is disconnected.
Reverse-protected power inputs: The BAT+ and BAT− are power inputs with reverse-voltage
protection. These are the recommended pins to use when connecting an external power supply
because they allow the P-Star’s reverse-voltage protection circuit to help prevent it from being
damaged by accidentally reversed power connections.
VI power output (or alternative input): When power is supplied through the BAT pins, the VIN
pin can be used as an output to supply reverse-protected power to other devices. Alternatively, the
external supply can be connected directly between VIN and ND, bypassing the reverse-voltage
protection.
5V power output: This pin provides access to the board’s 5 V supply, which comes from either the
USB 5 V bus voltage or the on-board switching regulator, depending on which power sources are
connected and enabled.
3V3 power output: This pin gives access to the output of the on-board 3.3 V linear regulator, which
can provide a few hundred milliamps of current.
VDD: The VDD pin powers the microcontroller and is connected directly to the 5V power output.
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
4. P-Star 45K50 Mini SV Page 13 of 46

P-Star 45K50 Mini SV, top view. P-Star 45K50 Mini SV dimensions, with
U.S. quarter for size reference.
USB power sensing
The voltage from USB (VBUS) powers a voltage divider that produces a voltage called VBUSLEV
that is 91% of VBUS. By default, VBUSLEV is connected to the RE2 pin through a cuttable trace on
the bottom of the board. This means that RE2 can be used as a digital or analog input to detect the
presence of USB power. Cutting the trace between the RE2 and VBUSLEV pads on the bottom of the
board allows RE2 to be used for other purposes. You can use solder to reconnect the two nodes.
External power sensing
The voltage on VIN powers a voltage divider that produces a voltage called BATLEV that is 9% of VIN.
By default, BATLEV is connected to the RE1 pin through a cuttable trace on the bottom of the board.
This means that RE1 can be used as an analog input to measure the external power supply voltage.
Cutting the trace between the RE1 and BATLEV pads on the bottom of the board allows RE1 to be
used for other purposes. You can use solder to reconnect the two nodes.
Reset button
The pushbutton on the P-Star 45K50 Mini resets the microcontroller when it is pressed.
Crystal
The P-Star 45K50 Mini has a precision 16 MHz crystal. By default, this crystal is used to provide a
clock signal for the microcontroller and its peripherals.
Included hardware
Two 1×18-pin breakaway 0.1″ male headers [https://www.pololu.com/product/965] and one 1×7-pin
breakaway 0.1″ male header are included with the P-Star 45K50 Mini. These header pins can be
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
4. P-Star 45K50 Mini SV Page 14 of 46

soldered in to use the board with perfboards, breadboards [https://www.pololu.com/category/28/solderless-
breadboards], or 0.1″ female connectors [https://www.pololu.com/category/50/0.1-2.54-mm-female-headers].
P-Star 45K50 Mini SV with included
optional headers.
P-Star 45K50 Mini SV on a breadboard,
shown with a vertical 5-pin ICSP
programming header installed.
4.2. P-Star 45K50 Mini SV schematic and dimensions
Schematic diagram
A schematic diagram is available as a PDF: P-Star 45K50 Mini SV schematic diagram
[https://www.pololu.com/file/0J1385/p-star-45k50-mini-sv-schematic.pdf] (252k pdf).
Dimension diagram
A dimension diagram for the P-Star 45K50 Mini SV will be available in this section soon.
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
4. P-Star 45K50 Mini SV Page 15 of 46

5. Getting started
5.1. Installing p-load and drivers
To use the P-Star’s USB bootloader, you will need to install a command-line utility called the Pololu
USB Bootloader Utility. This program is also known as “p-load” because that is the command used to
run it from a command prompt.
Windows
If you are using Microsoft Windows, you should download and install the Pololu USB Bootloader
Utility (p-load) for Windows [https://www.pololu.com/file/0J1125/p-load-2.3.0-win.msi] (1MB msi). This
includes the p-load executable and the drivers necessary for the P-Star bootloader. During the
installation, Windows will ask you if you want to install the drivers. Click “Install”.
After the installation has finished, your computer will automatically detect any P-Star that is in
bootloader mode and use the proper drivers for it. You should see an entry for the P-Star bootloader
in the “Universal Serial Bus devices” category or the “Pololu USB Devices” category in your Device
Manager. The latest drivers use the “Universal Serial Bus devices” category, but if your P-Star was set
up with an older driver, then it might still be in “Pololu USB Devices”.
Mac OS X
If you are using Mac OS X, you should download and install the Pololu USB Bootloader Utility (p-
load) for Mac OS X [https://www.pololu.com/file/0J1126/p-load-2.3.1-mac.pkg] (87k pkg). The latest version
of the utility software requires Mac OS X 10.11 or later. For older versions of Mac OS X, use p-load
1.0.0 [https://www.pololu.com/file/0J802/p-load-1.0.0.dmg] (33k dmg) instead (which only supports the P-Star
25K50).
Linux
If you are using Linux, you should download and install the appropriate version of the Pololu USB
Bootloader Utility below:
•Pololu USB Bootloader Utility (p-load) for Linux (x86) [https://www.pololu.com/file/0J1380/p-
load-2.3.1-linux-x86.tar.xz] (478k xz) – works on 32-bit and 64-bit systems
•Pololu USB Bootloader Utility (p-load) for Linux (Raspberry Pi) [https://www.pololu.com/file/
0J1381/p-load-2.3.1-linux-rpi.tar.xz] (374k xz) – works on the Raspberry Pi and might work on
other ARM Linux systems
Run tar -xvf p-load-*.tar.xz to extract the software, and then follow the directions in README.txt
to install it.
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
5. etting started Page 16 of 46

Source code
The Pololu USB Bootloader Utility source code [https://github.com/pololu/p-load] is also available, so
you can build the utility yourself.
5.2. Getting into bootloader mode
The P-Star comes with a USB bootloader that allows you to load new programs onto the P-Star over
USB without using an external programmer. To use the bootloader, you will first need to get the P-Star
into bootloader mode.
When the P-Star is in bootloader mode, the yellow LED should be on and the green LED should be
blinking. If the P-Star has never been programmed, or if the user application has been erased, then
the P-Star will automatically go into bootloader mode when it is powered on. Otherwise, you will have
to use one of the procedures below to get it into bootloader mode.
Starting the bootloader with a wire or button
The P-Star will go into bootloader mode if the RB6 line is high immediately after a reset. This will work
no matter what type of application is loaded on the P-Star.
For example, if your P-Star is only powered from USB, you could hold a wire between VDD and RB6
while you are plugging the P-Star into USB in order to get it into bootloader mode.
Another option is to connect a bootloader button between VDD and RB6 and a reset button between
ND and MCLR as shown in the picture below, and reset the P-Star while you are holding down
the bootloader button. The picture below shows one way to hook up those two buttons to a P-Star
25K50 Micro on a breadboard, using our two of our mini pushbutton switches [https://www.pololu.com/
product/1400]. If you have a P-Star 45K50 Mini, you can do the same thing, except it is probably more
convenient to use the reset button on the board instead of connecting an external one.
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
5. etting started Page 17 of 46

P-Star 25K50 Micro on a breadboard with a reset button (left) and a bootloader
button (on-board).
The bootloader button can be used for other purposes while your application is running. However, be
careful to never drive the RB6 line low, or else pressing the button could cause a short circuit.
Starting the bootloader from your application
The bootloader can also be started by the application without requiring a reset. To do this, the
application can simply jump to address 4 using the assembly instruction goto 4 . If the application
uses USB, it should disable the USB module by clearing USBEN and then wait for at least 100 ms
before starting the bootloader in order to give the computer time to detect that the application has
disconnected.
For convenience, we recommend that any P-Star applications with a USB interface implement a USB
command for starting the bootloader. This would allow you to get into bootloader mode, upload the
new firmware, and run it, entirely using USB and not needing any physical interaction with the board.
For example, an application with a USB virtual COM port could listen for a special baud rate to be set
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
5. etting started Page 18 of 46

by the computer.
5.3. Compiling a program with MPLAB X and XC8
The P-Star can be programmed using standard development tools from Microchip. This section
explains how to get started programming the P-Star in the C language using MPLAB X and XC8.
MPLAB X [http://www.microchip.com/mplabx] a free integrated development (IDE) from Microchip for
programming their PIC microcontrollers. XC8 [http://www.microchip.com/compilers] is a C compiler from
Microchip for 8-bit PICs. Both programs run on Windows, Max OS X, and Linux.
1. Download and install the latest versions of MPLAB X [http://www.microchip.com/mplabx] and
XC8 [http://www.microchip.com/compilers] .
2. Find “MPLAB X IDE” in your Start Menu and run it.
3. From the File menu, select “New Project”.
4. On the first screen of the New Project wizard, select the “Microchip Embedded” category and
then select “Standalone Project”. Click “Next”.
5. For the Device, type the name of the microcontroller on your P-Star, which is either
“PIC18F25K50” or “PIC18F45K50”. Click “Next”.
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
5. etting started Page 19 of 46

6. On the “Select Tool” screen, you can select “PICkit 3” but this choice does not matter because
we will not use MPLAB X to the load the program onto the board.
7. For the compiler, select XC8.
8. For the Project Name, choose something like “p-star1”, and choose the folder you want it to
be in. Click “Finish” to create the project.
Pololu P-Star User’s uide © 2001–2019 Pololu Corporation
5. etting started Page 20 of 46
This manual suits for next models
2
Table of contents
Other Pololu Control Unit manuals
Popular Control Unit manuals by other brands

Honeywell
Honeywell D04FM installation instructions

Vivaldi
Vivaldi Giove AC5 user manual

Skylab
Skylab WG209-User user manual

CALEFFI
CALEFFI Altecnic SATK40103 Installation, operation & maintenance instructions

Advantech
Advantech EPD-132 user manual

Mitsubishi Electric
Mitsubishi Electric AJ65BT-68TD user manual