Skip to main content

labjack_pic

Program PIC microcontrollers using LabJack U3

I have multiple PICkits 1, 2, and 3, but none of them can program the part I selected for my latest project. Rather than shell out for yet another PICkit, I wrote this script to program the part using a LabJack U3 which I already had lying around.

Connections

Connect GND, MCLR, ICSPDAT, ICSPCLK to FIOs on the LabJack. Defaults are:

  • MCLR on FIO4
  • ICSPDAT on FIO5
  • ICSPCLK on FIO6

You can select different pins with the --mclr, --icspdat, and --icspclk arguments.

If your circuit is OK with 5V power and doesn't draw too much current, you can power it with VS (USB power). Otherwise arrange some other power supply. LabJack outputs are 3.3 V, so lower voltages are a bad idea.

Installation

pip3 install labjack_pic

Usage

labjack_pic [filename.hex]

This programs the hex file:

  • If the hex file contains program code, it will bulk erase that area first
  • If the hex file contains config words, it will erase those first
  • If the hex file contains user id words, it will erase that area first
  • If the hex file contains EEPROM data, it will not erase that first. It will update any bytes specified.

Devices supported

This script only supports low-voltage programming. This means MCLR is not available as a general-purpose input in the circuit. This also means that this programmer cannot recover a part that has been programmed to MCLR-as-input.

Currently supports devices covered by Programming Specification 40002317, Programming Specification 40002266, and Programming Specification 40001683B

These are:

  • PIC16F1703
  • PIC16LF1703
  • PIC16F1704
  • PIC16LF1704
  • PIC16F1705
  • PIC16LF1705
  • PIC16F1707
  • PIC16LF1707
  • PIC16F1708
  • PIC16LF1708
  • PIC16F1709
  • PIC16LF1709
  • PIC16F17114
  • PIC16F17115
  • PIC16F17124
  • PIC16F17125
  • PIC16F17126
  • PIC16F17144
  • PIC16F17145
  • PIC16F17146
  • PIC16F17154
  • PIC16F17155
  • PIC16F17156
  • PIC16F17174
  • PIC16F17175
  • PIC16F17176
  • PIC16F18013
  • PIC16F18023
  • PIC16F18014
  • PIC16F18024
  • PIC16F18044
  • PIC16F18054
  • PIC16F18074
  • PIC16F18015
  • PIC16F18025
  • PIC16F18045
  • PIC16F18055
  • PIC16F18075
  • PIC16F18026
  • PIC16F18046
  • PIC16F18056
  • PIC16F18076

I would accept patches to support other PICs, but larger memory devices are probably going to be obnoxiously slow to program with LabJack hardware.

Performance

The SPI clock of the U3 is relatively slow. Writing takes maybe 2-3x as long as a proper programmer that can do the full 5 MHz clock.

Metadata

Release files for labjack-pic 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for labjack-pic 0.0.11
File Size Uploaded Provenance Actions
labjack_pic-0.0.11.tar.gz 18.3 kB Without provenance Details for labjack_pic-0.0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for labjack-pic 0.0.11
File Interpreter ABI Platform Actions
labjack_pic-0.0.11-py3-none-any.whl Python 3 none any Details for labjack_pic-0.0.11-py3-none-any.whl

Total release size: 36.6 kB

Release files / labjack_pic-0.0.11.tar.gz

Download URL labjack_pic-0.0.11.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
96846a4f9a2a3d2d87f4fb5661dcaa12e78c71f09108aef182649cc8437d5c37
BLAKE2b-256 checksum
How to use checksums
0c4ef44b9cac8ee0ed139429edd9daa24acf2681342f01b829033b5e349ca0db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / labjack_pic-0.0.11-py3-none-any.whl

Download URL labjack_pic-0.0.11-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
edb70e25e0fe34926c80a45b57fe2042a84004c34fb3b631ddd11f6d315d2966
BLAKE2b-256 checksum
How to use checksums
577d409637603932e517f4fe22876037f2ae9782b99251243a7a99b7705d4eef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for labjack-pic 0.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page