Microchip logo
  • All
  • Products
  • Documents
  • Applications Notes

8-Bit MCUs

PIC18F K42 Microcontroller Family

High-Performance and Large-Memory 8-Bit MCUs

The PIC18F K42 family of microcontrollers consists of ten highly integrated products — ranging from 16-128 KB of flash memory with package options covering 28-48 pins. This family is equipped with a comprehensive and rich set of Core Independent Peripherals (CIPs) and Intelligent Analog features allowing for many functional tasks to be done in hardware – saving code, validation time, core overhead and power consumption.

These MCUs feature a 12-bit ADC with Computation (ADC2), Direct Memory Access (DMA), Vector Interrupt (VI) Controller and other system enhancements. They are ideal for an extensive range of applications and markets, including automotive, industrial control, Internet of Things (IoT), medical and white goods. The MCUs offer a full suite of Core Independent Peripherals for safety-critical applications (Cyclic Redundancy Check with Memory Scan, Windowed Watchdog Timer, 24-bit Signal Measurement Timer, Hardware Limit Timer, Complementary Waveform Generation), up to eight hardware PWMs and multiple communications interfaces. They include a Configurable Logic Cell which integrates hardware functions to simplify and accelerate many common tasks.

Intelligent Analog

This family of products offer intelligent analog peripherals including Zero Cross Detect (ZCD), on-chip comparator and a 12-bit ADC2, automating Capacitive Voltage Divider (CVD) techniques for advanced touch sensing, averaging, filtering, oversampling and threshold comparison.

Faster Interrupt Response Times

Vectored Interrupts (VI) reduce response time by introducing an interrupt hierarchy and executing Interrupt Service Routines (ISR) directly. The VI uses Interrupt Vector Tables (IVT) to provide each interrupt source with an interrupt vector. When an interrupt occurs, the ISR is executed immediately, without the need to expend clock cycles scanning the source’s flag bits. This combination of ISR and IVT allow interrupts to be handled entirely through hardware, removing the need to implement a priority system in software and thereby decreasing development time and increasing performance.

Improved Peripheral Performance

The Direct Memory Access (DMA) Controller eliminates the need for CPU involvement in data transfers between all memory spaces and peripherals, thereby reducing the number of interrupts and improving peripheral performance.

Enhanced System Features

Memory Access Partition (MAP) supports customers in data protection and bootloader applications. Device Information Area (DIA) is a dedicated memory space for factory programmed device ID and peripheral calibration values. Additionally, the MCUs have improved serial communications, including UART with support for Asynchronous, DMX, DALI and LIN protocols along with higher-speed, standalone I2C and SPI serial communication interfaces.


Getting Started

The Curiosity High Pin Count (HPC) Development Board (DM164136) supports the PIC18F K42 product family. Curiosity Development Boards are cost-effective, fully-integrated MCU development platforms. The development board includes an integrated programmer/debugger and requires no additional hardware to get started.

The PIC18F K42 product family is also supported by MPLAB® Code Configurator (MCC), a free software plug-in that provides a graphical interface to configure peripherals and functions specific to your application.  MCC is incorporated into our award-winning Integrated Development Environments (IDEs), the downloadable MPLAB X IDE and the cloud-based MPLAB Xpress IDE. Additionally, several Xpress code examples are available to help designers start development immediately.


Building Blocks for Real-Time Control

Analog to Digital Converter with Computation (ADC2)

The Analog to Digital Converter with Computation helps accelerate common math tasks normally done in software by providing post-processing functions like averaging, low-pass filter, oversampling and threshold comparison.

More Information

Zero Cross Detect (ZCD)

The Zero Cross Detect module can monitor AC line voltage and indicate zero crossing activity. This information is made directly available to the on-board Waveform Generation peripherals for use in TRIAC control applications, greatly reducing both CPU demand and overall development cost by lowering the bill of materials.

More Information

10-bit PWM

The 10-bit PWM provides edge-aligned output which can be used with the Complementary Waveform Generator.

Complementary Waveform Generator (CWG)

Complementary Waveform Generator provides a complementary waveform with rising and falling edge dead band control, enabling high-efficiency synchronous switching with no processor overhead. The CWG also incorporates auto shutdown, auto restart and can interface directly with other peripherals/external inputs.

More Information

Numerically Controlled Oscillator (NCO)

Numerically Controlled Oscillator is a precision linear frequency generator with fine step resolution. It provides high-resolution oscillator capabilities to control applications such as lighting ballast, radio and tone generator.

More Information

Hardware Limit Timer (HLT)

The Hardware Limit Timer can detect faults in motors, power supplies, and other external devices. It can automatically notify the system to make provisions to shut down and/or safely restart.

More Information

24-bit Signal Measurement Timer (SMT)

The 24-bit Signal Measurement Timer performs high-resolution measurements of any digital signal in hardware, resulting in near zero latency and high performance when decoding custom communications protocols or signaling.

More Information

Configurable Logic Cell (CLC)

The Configurable Logic Cell offers hardware-based combinational and sequential logic functions to simplify and accelerate many common tasks. The CLC can also be used as “glue” logic between peripherals, eliminating the need for CPU intervention during steady-state activity in complex control loops.

More Information

CRC/SCAN module and the Windowed Watchdog Timer (WWDT)

The CRC/SCAN module and the Windowed Watchdog Timer work in tandem to provide engineers with the tools necessary to incorporate functional safety into their application. By ensuring the integrity of the program FLASH contents, PICF19197 devices support the implementation of safety standards such as Class B and UL 1998.

More Information on WWDT

More Information on CRC/SCAN

Peripheral Pin Select (PPS)

Peripheral Pin Select provides ultimate flexibility when routing digital signals to device pins. With PPS, any digital peripheral can be connected to any I/O pin on-the-fly for a customized layout. This allows users to maintain layout compatibility with older PIC® MCUs, even as new features are implemented.

More Information

Advanced Memory Features

Memory Access Partition (MAP) supports customers in data protection and bootloader applications. Device Information Area (DIA) is a dedicated memory space for factory programmed device ID and peripheral calibration values.

Power Conserving Functionality

IDLE and DOZE low-power modes allow applications to optimize device performance and power consumption. The Peripheral Module Disable (PMD) allows unused peripherals to be turned off individually, further reducing power consumption. The device features the industry-leading eXtreme Lower Power (XLP) technology.


PIC18F K42 Key Attributes

  • 64MHz Internal Oscillator
  • Up to 128KB Flash Program Memory
  • Up to 1KB Data EEPROM
  • Up to 8K of SRAM
  • Vectored Interrupt Capability
  • Direct Access Memory (DMA) Controllers
  • 12-bit ADC with Computation (ADC2), up to 43 channels
  • Memory Access Partition (MAP)
  • Device Information Area (DIA)
  • Windowed Watch Dog Timer (WWDT)
  • Up to three Complementary Waveform Generator (CWG)
  • Four Configurable Logic Cell (CLC)
  • Peripheral Pin Select (PPS)
  • Two Comparators
  • Zero Cross Detect (ZCD)
  • On-chip Temperature Indicator
  • Data Signal Modulator (DSM)
  • 5-bit DAC
  • Capacitive Voltage Divider (CVD)
  • Up to four 10-bit PWMs
  • Communication: UART, SPI, and I2C
  • Available in 28-, 40- and 48-pins